From mboxrd@z Thu Jan 1 00:00:00 1970 From: hjl@lucon.org (H.J. Lu) To: law@cygnus.com Cc: shimpei+usenet+.mil+.gov@BOFH.submm.caltech.edu, mlist-egcs@nntp-server.caltech.edu Subject: Re: asinh() gives NaN on Linux/x86/glibc with optimization on Date: Tue, 22 Dec 1998 22:34:00 -0000 Message-id: References: <9143.914384936@hurl.cygnus.com> X-SW-Source: 1998-12/msg00875.html > 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 * sysdeps/i386/fpu/__math.h (asinh): Put __sgn1 call outside log1p call. -- H.J. Lu (hjl@gnu.org)