bug-gnulib
[Top][All Lists]
Advanced

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

strtod on HP-UX 11


From: Bruno Haible
Subject: strtod on HP-UX 11
Date: Sat, 1 Jan 2011 02:58:20 +0100
User-agent: KMail/1.9.9

Hi Eric,

On HP-UX 11.11 and 11.31 I see this test failure:

  test-strtod.c:588: assertion failed

and when this one is fixed:

  test-strtod.c:652: assertion failed

The reason is that the system's strtod function, when parsing infinity or
nan, clobbers errno. (In fact, the test in m4/strtod.m4 fails with exit code
120 = 64 | 32 | 16 | 8.)

This fixes it for me. OK to commit?


2010-12-31  Bruno Haible  <address@hidden>

        strtod: Restore errno when successfully parsing Infinity or NaN.
        * lib/strtod.c (strtod): After successfully parsing an Infinity or NaN,
        restore the original errno.

--- lib/strtod.c.orig   Sat Jan  1 02:53:15 2011
+++ lib/strtod.c        Sat Jan  1 02:53:02 2011
@@ -303,6 +303,7 @@
           && c_tolower (s[4]) == 'y')
         s += 5;
       num = HUGE_VAL;
+      errno = saved_errno;
     }
   else if (c_tolower (*s) == 'n'
            && c_tolower (s[1]) == 'a'
@@ -325,6 +326,7 @@
          to interpreting n-char-sequence as a hexadecimal number.  */
       if (s != end)
         num = NAN;
+      errno = saved_errno;
     }
   else
     {



reply via email to

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