Bug 5680 - math functions (atanh, log, log1p) are inconsistent in treatment of errno
Summary: math functions (atanh, log, log1p) are inconsistent in treatment of errno
Status: RESOLVED DUPLICATE of bug 6792
Alias: None
Product: glibc
Classification: Unclassified
Component: math (show other bugs)
Version: unspecified
: P2 normal
Target Milestone: ---
Assignee: Andreas Jaeger
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-01-26 02:45 UTC by Mark Dickinson
Modified: 2014-07-02 07:44 UTC (History)
2 users (show)

See Also:
Host: i686-pc-linux-gnu
Target: i686-pc-linux-gnu
Build: i686-pc-linux-gnu
Last reconfirmed:
fweimer: security-


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Mark Dickinson 2008-01-26 02:45:49 UTC
In version 2.5 of glibc, on SuSE Linux 10.2, it appears that the libm functions atanh, log and log1p (and 
possibly others) are inconsistent in their handling of singularities:

log(0.0) returns -Infinity and sets errno = ERANGE
log1p(-1.0) returns -Infinity and doesn't set errno
atanh(-1.0) returns -Infinity and sets errno = EDOM.

According to the C99 standard (appendix F), and IEEE-754r, all of these operations should behave in 
the same way---they should all return -Infinity and raise the "divide-by-zero" exception. This makes 
sense mathematically:  all three function calls correspond to singularities of log type.  Admittedly, the 
C99 standard has little to say about errno, but I don't understand why these three calls behave 
differently with respect to setting of errno.
Comment 1 Joseph Myers 2012-02-29 20:12:25 UTC
atanh was fixed by:

2009-04-26  Ulrich Drepper  <drepper@redhat.com>

        * sysdeps/ieee754/k_standard.c (__kernel_standard): Pole errors in
        atanh should set ERANGE.

All functions also raise divide-by-zero.  So the only bug left here is for log1p, which should set errno to ERANGE.  That's one particular case of the problems for log1p detailed in bug 6792.

*** This bug has been marked as a duplicate of bug 6792 ***