This is the mail archive of the libc-alpha@sources.redhat.com 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]

acosh patch



For large x, acosh(x) = log(x) + log(2).  The threshold of "large" is
2^28, copied from the double precision routine into the long double
routines.  That is somewhat too small for 80-bit long double and
much too small for the 128-bit format.

For example with  x = 2^28 = 2.68435456e8,
 acosh(x) = 2.010126823623841396963028457033350627e1
 log(2x)  = 2.010126823623841397309973152228712047e1
which differ by 1.7 parts in 10^19.

	* sysdeps/ieee754/ldbl-96/e_acoshl.c (__ieee754_acoshl):
	  acosh(x) = ln(2x) if x > 2^30.
	* sysdeps/ieee754/ldbl-128/e_acoshl.c (__ieee754_acoshl):
	   acosh(x) = ln(2x) if x > 2^54.

*** sysdeps/ieee754/ldbl-96/e_acoshl.c	1999/07/14 00:11:15	1.1
--- sysdeps/ieee754/ldbl-96/e_acoshl.c	2001/07/01 13:06:11
*************** ln2	= 6.931471805599453094287e-01L; /* 0
*** 55,61 ****
  	GET_LDOUBLE_WORDS(se,i0,i1,x);
  	if(se<0x3fff || se & 0x8000) {	/* x < 1 */
  	    return (x-x)/(x-x);
! 	} else if(se >=0x401b) {	/* x > 2**28 */
  	    if(se >=0x7fff) {		/* x is inf of NaN */
  	        return x+x;
  	    } else
--- 55,61 ----
  	GET_LDOUBLE_WORDS(se,i0,i1,x);
  	if(se<0x3fff || se & 0x8000) {	/* x < 1 */
  	    return (x-x)/(x-x);
! 	} else if(se >=0x401d) {	/* x > 2**30 */
  	    if(se >=0x7fff) {		/* x is inf of NaN */
  	        return x+x;
  	    } else

*** sysdeps/ieee754/ldbl-128/e_acoshl.c	1999/07/14 00:04:46	1.1
--- sysdeps/ieee754/ldbl-128/e_acoshl.c	2001/07/01 13:56:06
*************** ln2	= 0.69314718055994530941723212145817
*** 51,57 ****
  	GET_LDOUBLE_WORDS64(hx,lx,x);
  	if(hx<0x3fff000000000000LL) {		/* x < 1 */
  	    return (x-x)/(x-x);
! 	} else if(hx >=0x401b000000000000LL) {	/* x > 2**28 */
  	    if(hx >=0x7fff000000000000LL) {	/* x is inf of NaN */
  	        return x+x;
  	    } else
--- 51,57 ----
  	GET_LDOUBLE_WORDS64(hx,lx,x);
  	if(hx<0x3fff000000000000LL) {		/* x < 1 */
  	    return (x-x)/(x-x);
! 	} else if(hx >=0x4035000000000000LL) {	/* x > 2**54 */
  	    if(hx >=0x7fff000000000000LL) {	/* x is inf of NaN */
  	        return x+x;
  	    } else




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