This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: asinh() gives NaN on Linux/x86/glibc with optimization on
- To: law at cygnus dot com
- Subject: Re: asinh() gives NaN on Linux/x86/glibc with optimization on
- From: hjl at lucon dot org (H.J. Lu)
- Date: Tue, 22 Dec 1998 22:33:40 -0800 (PST)
- Cc: shimpei+usenet+ dot mil+ dot gov at BOFH dot submm dot caltech dot edu, mlist-egcs at nntp-server dot caltech dot edu
> Here's glibc 2.0.7's definition of asinh() from /usr/include/__math.h:
>
> __MATH_INLINE double asinh (double __x);
> __MATH_INLINE double
> asinh (double __x)
> {
> register double __y = fabs (__x);
>
> return log1p ((__y * __y / (sqrt (__y * __y + 1.0) + 1.0) + __y)
> * __sgn1 (__x));
> }
>
> Here's a correct definition:
>
> __MATH_INLINE double asinh (double __x);
> __MATH_INLINE double
> asinh (double __x)
> {
> register double __y = fabs (__x);
>
> return log1p ((__y * __y / (sqrt (__y * __y + 1.0) + 1.0) + __y))
> * __sgn1 (__x);
> }
>
> The __sgn1() function (which computes the sign of its argument) should
> go outside the log1p(), not inside it. The argument of log1p() is
> supposed to be positive here. The __sgn1() is meant to invert the
> sign of the result for negative arguments of asinh(), since asinh(-x)
> = -asinh(x).
>
> (Actually this correction gives an extra pair of parens around the
> argument of log1p(), which could be removed.)
>
1998-10-26 Ulrich Drepper <drepper@cygnus.com>
* sysdeps/i386/fpu/__math.h (asinh): Put __sgn1 call outside log1p
call.
--
H.J. Lu (hjl@gnu.org)