This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


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

Re: asinh() gives NaN on Linux/x86/glibc with optimization on


>   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)


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