Branch
Hash :
74f3ed88
Author :
Date :
2024-11-19T09:11:22
doc: mention strtol no-conversion + EINVAL
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112
@node strtod
@subsection @code{strtod}
@findex strtod
POSIX specification:@* @url{https://pubs.opengroup.org/onlinepubs/9799919799/functions/strtod.html}
Gnulib module: strtod or strtod-obsolete
@mindex strtod
@mindex strtod-obsolete
Portability problems fixed by either Gnulib module @code{strtod} or @code{strtod-obsolete}:
@itemize
@item
This function mis-parses strings with leading @samp{+} on some old platforms:
Old versions of Linux.
@item
This function returns a wrong end pointer on some old platforms.
@item
This function allows whitespace between @samp{e} and the exponent on
some platforms:
HP-UX 11.11.
@item
This function returns the wrong end pointer for @samp{-0x} on some
platforms:
glibc 2.4, Mac OS X 10.5, FreeBSD 6.2, AIX 7.1, Cygwin < 1.5.25-11.
@item
This function fails to parse Infinities and plain NaNs on some platforms:
OpenBSD 4.0, HP-UX 11.11, Solaris 9, mingw, MSVC 14.
@item
This function fails to parse @samp{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.
@item
This function fails to parse @samp{NaN(@var{n-char-sequence})} on some
platforms:
OpenBSD 4.0, HP-UX 11.11, mingw, MSVC 14.
@item
This function parses @samp{NaN(@var{n-char-sequence})}, but returns
the wrong end pointer on some platforms:
glibc 2.4, AIX 7.1.
@item
This function misparses @samp{nan(} on some platforms:
macOS 10.6.6.
@item
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.
@item
In hexadecimal floats, this function allows whitespace between @samp{p}
and the exponent on some platforms:
HP-UX 11.31/ia64.
@item
This function returns the wrong end pointer for @samp{0x1p} on some
platforms:
AIX 7.1.
@item
@c The term "underflow", as defined by ISO C23 ยง 7.12.1.(6), includes both
@c "gradual underflow" (result is a denormalized number) and "flush-to-zero
@c underflow" (result is zero).
This function fails to set @code{errno} upon gradual underflow (resulting
in a denormalized number) on some platforms:
Cygwin 2.9.
@end itemize
Portability problems fixed by Gnulib module @code{strtod-obsolete}:
@itemize
@item
This function is missing on some old platforms.
@end itemize
Portability problems not fixed by Gnulib:
@itemize
@item
This function returns +0.0 (not @minus{}0.0) for negative underflow on some
platforms:
glibc 2.7, Cygwin 1.5.x, mingw, MSVC 14.
@item
This function cannot distinguish between ``nan'' and ``-nan'' on some
platforms:
glibc 2.7, mingw, MSVC 14.
@item
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.
@item
This function fails to set @code{errno} upon gradual underflow (resulting
in a denormalized number) on some platforms:
MSVC 14.
@item
The replacement function does not always return correctly rounded results.
@item
If no conversion could be performed, this function sets @code{errno}
to @code{EINVAL} on some platforms. Portable programs should check
for no conversion by comparing @code{str} to @code{*endptr}, not by
inspecting @code{errno}.
@end itemize