This is the mail archive of the
glibc-bugs@sourceware.org
mailing list for the glibc project.
[Bug math/9696] New: strtod() should not return EDOM
- From: "peter_e at gmx dot net" <sourceware-bugzilla at sourceware dot org>
- To: glibc-bugs at sources dot redhat dot com
- Date: 30 Dec 2008 12:12:50 -0000
- Subject: [Bug math/9696] New: strtod() should not return EDOM
- Reply-to: sourceware-bugzilla at sourceware dot org
During testing of corner cases in our software, we have discovered
that
strtod("1E-324", NULL)
sets errno = EDOM. I think this is not correct.
POSIX says this:
"""
These functions shall fail if:
[ERANGE]
The value to be returned would cause overflow or underflow.
These functions may fail if:
[EINVAL]
No conversion could be performed.
"""
EDOM isn't even mentioned here. My test case is an underflow case,
so ERANGE should be set.
Also note that the analogous overflow case strtod("1E+324", NULL)
does set ERANGE.
For comparison, the BSD libc (Mac OS X) as well as HP-UX set ERANGE
in both cases.
The section in the glibc documentation "20.5.4 Error Reporting by
Mathematical Functions" also appears to predict an ERANGE result.
Bug #6776, while unrelated code, mentions a similar issue of EDOM/
ERANGE confusion.
--
Summary: strtod() should not return EDOM
Product: glibc
Version: 2.8
Status: NEW
Severity: normal
Priority: P2
Component: math
AssignedTo: aj at suse dot de
ReportedBy: peter_e at gmx dot net
CC: glibc-bugs at sources dot redhat dot com
http://sourceware.org/bugzilla/show_bug.cgi?id=9696
------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.