From ca7b5b8152920d8b83da8d636207b323ca52ac2c Mon Sep 17 00:00:00 2001 From: Bruno Haible Date: Wed, 2 Apr 2008 03:29:50 +0200 Subject: [PATCH] Fix test to work on IRIX 6.5 with cc. --- ChangeLog | 6 ++++++ tests/test-math.c | 13 ++++++++++++- 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 1f84a20e9e..9232d1d516 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2008-04-01 Bruno Haible + + Fix test to work on IRIX 6.5 with cc. + * tests/test-math.c (numeric_equal): New function. + (main): Use it. + 2008-04-01 Bruno Haible * doc/posix-headers/math.texi: Refine documentation of NAN problem. diff --git a/tests/test-math.c b/tests/test-math.c index 56cf058c48..ec654b2601 100644 --- a/tests/test-math.c +++ b/tests/test-math.c @@ -30,9 +30,20 @@ choke me static float n = NAN; #endif +/* Compare two numbers with ==. + This is a separate function because IRIX 6.5 "cc -O" miscompiles an + 'x == x' test. */ +static int +numeric_equal (double x, double y) +{ + return x == y; +} + int main () { double d = NAN; - return d == d; + if (numeric_equal (d, d)) + return 1; + return 0; } -- 2.30.2