bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: strtod bugs


From: Bruno Haible
Subject: Re: strtod bugs
Date: Tue, 1 Apr 2008 00:04:38 +0200
User-agent: KMail/1.5.4

Eric Blake wrote:
> The problem was that Solaris 8 does not define NAN anywhere, so the
> test failures I saw in the NaN section of test-strtod.c were because
> Solaris was correctly parsing NaN, but the test thought that NaN was not
> possible.

So, the '#ifdef NAN' needs to go. It's less portable than a '#if 1'. All
CPUs nowadays (and already for 15 years) support NaNs. The IEEE 754/854
are not supported to the letter, but their essential features (NaNs,
Infinities, +/- 0) are supported everywhere. Denormalized numbers are
not supported by 'long double' on some platforms.

Bruno


2008-03-31  Bruno Haible  <address@hidden>

        * tests/test-strtod.c (main): Don't test NAN macro. Needed for Solaris.
        Reported by Eric Blake.

--- tests/test-strtod.c.orig    2008-03-31 23:56:50.000000000 +0200
+++ tests/test-strtod.c 2008-03-31 23:56:26.000000000 +0200
@@ -542,7 +542,7 @@
     char *ptr2;
     double result1 = strtod (input, &ptr1);
     double result2 = strtod (input + 1, &ptr2);
-#ifdef NAN
+#if 1 /* All known CPUs support NaNs.  */
     ASSERT (isnan (result1));           /* OpenBSD 4.0, IRIX 6.5, OSF/1 5.1, 
mingw */
     ASSERT (isnan (result2));           /* OpenBSD 4.0, IRIX 6.5, OSF/1 5.1, 
mingw */
 # if 0
@@ -570,7 +570,7 @@
     char *ptr2;
     double result1 = strtod (input, &ptr1);
     double result2 = strtod (input + 1, &ptr2);
-#ifdef NAN
+#if 1 /* All known CPUs support NaNs.  */
     ASSERT (isnan (result1));           /* OpenBSD 4.0, HP-UX 11.11, IRIX 6.5, 
OSF/1 5.1, mingw */
     ASSERT (isnan (result2));           /* OpenBSD 4.0, HP-UX 11.11, IRIX 6.5, 
OSF/1 5.1, mingw */
     ASSERT (!!signbit (result1) == !!signbit (result2));
@@ -594,7 +594,7 @@
     char *ptr2;
     double result1 = strtod (input, &ptr1);
     double result2 = strtod (input + 1, &ptr2);
-#ifdef NAN
+#if 1 /* All known CPUs support NaNs.  */
     ASSERT (isnan (result1));           /* OpenBSD 4.0, HP-UX 11.11, IRIX 6.5, 
OSF/1 5.1, mingw */
     ASSERT (isnan (result2));           /* OpenBSD 4.0, HP-UX 11.11, IRIX 6.5, 
OSF/1 5.1, mingw */
 # if 0
@@ -620,7 +620,7 @@
     const char input[] = " nan().";
     char *ptr;
     double result = strtod (input, &ptr);
-#ifdef NAN
+#if 1 /* All known CPUs support NaNs.  */
     ASSERT (isnan (result));            /* OpenBSD 4.0, HP-UX 11.11, IRIX 6.5, 
OSF/1 5.1, mingw */
     ASSERT (ptr == input + 6);          /* glibc-2.3.6, MacOS X 10.3, FreeBSD 
6.2, OpenBSD 4.0, AIX 5.1, HP-UX 11.11, IRIX 6.5, OSF/1 5.1, mingw */
     ASSERT (errno == 0);
@@ -641,7 +641,7 @@
     char *ptr2;
     double result1 = strtod (input, &ptr1);
     double result2 = strtod (input + 1, &ptr2);
-#ifdef NAN
+#if 1 /* All known CPUs support NaNs.  */
     ASSERT (isnan (result1));           /* OpenBSD 4.0, HP-UX 11.11, IRIX 6.5, 
OSF/1 5.1, mingw */
     ASSERT (isnan (result2));           /* OpenBSD 4.0, HP-UX 11.11, IRIX 6.5, 
OSF/1 5.1, mingw */
 # if 0





reply via email to

[Prev in Thread] Current Thread [Next in Thread]