This is the mail archive of the glibc-bugs@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug math/9696] New: strtod() should not return EDOM


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.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]