10.46.65 strtod
¶
POSIX specification:
https://pubs.opengroup.org/onlinepubs/9799919799/functions/strtod.html
Gnulib module: strtod or strtod-obsolete
Portability problems fixed by either Gnulib module strtod
or strtod-obsolete
:
- This function mis-parses strings with leading ‘+’ on some old platforms:
Old versions of Linux.
- This function returns a wrong end pointer on some old platforms.
- This function allows whitespace between ‘e’ and the exponent on
some platforms:
HP-UX 11.11.
- This function returns the wrong end pointer for ‘-0x’ on some
platforms:
glibc 2.4, Mac OS X 10.5, FreeBSD 6.2, AIX 7.1, Cygwin < 1.5.25-11.
- This function fails to parse Infinities and plain NaNs on some platforms:
OpenBSD 4.0, HP-UX 11.11, Solaris 9, mingw, MSVC 14.
- This function fails to parse ‘NaN()’ on some platforms:
glibc 2.3.6, Mac OS X 10.5, FreeBSD 6.2, OpenBSD 4.0, AIX 7.1, HP-UX 11.11, Cygwin < 1.5.25-11, mingw, MSVC 14.
- This function fails to parse ‘NaN(n-char-sequence)’ on some
platforms:
OpenBSD 4.0, HP-UX 11.11, mingw, MSVC 14.
- This function parses ‘NaN(n-char-sequence)’, but returns
the wrong end pointer on some platforms:
glibc 2.4, AIX 7.1.
- This function misparses ‘nan(’ on some platforms:
macOS 10.6.6.
- This function fails to parse C99 hexadecimal floating point on some
platforms:
NetBSD 5.0, OpenBSD 4.0, AIX 5.1, HP-UX 11.11, Solaris 11.4, mingw, MSVC 14.
- In hexadecimal floats, this function allows whitespace between ‘p’
and the exponent on some platforms:
HP-UX 11.31/ia64.
- This function returns the wrong end pointer for ‘0x1p’ on some
platforms:
AIX 7.1.
- This function fails to set
errno
upon gradual underflow (resulting
in a denormalized number) on some platforms:
Cygwin 2.9.
Portability problems fixed by Gnulib module strtod-obsolete
:
- This function is missing on some old platforms.
Portability problems not fixed by Gnulib:
- This function returns +0.0 (not −0.0) for negative underflow on some
platforms:
glibc 2.7, Cygwin 1.5.x, mingw, MSVC 14.
- This function cannot distinguish between “nan” and “-nan” on some
platforms:
glibc 2.7, mingw, MSVC 14.
- This function fails to correctly parse very long strings on some
platforms:
Mac OS X 10.5, FreeBSD 6.2, NetBSD 5.0, OpenBSD 4.0, Cygwin, mingw, MSVC 14.
- This function fails to set
errno
upon gradual underflow (resulting
in a denormalized number) on some platforms:
MSVC 14.
- The replacement function does not always return correctly rounded results.
- If no conversion could be performed, this function sets
errno
to EINVAL
on some platforms. Portable programs should check
for no conversion by comparing str
to *endptr
, not by
inspecting errno
.