123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869 |
- #if defined(LIBM_SCCS) && !defined(lint)
- static char rcsid[] = "$NetBSD: e_acosh.c,v 1.9 1995/05/12 04:57:18 jtc Exp $";
- #endif
- #include "math.h"
- #include "math_private.h"
- #ifdef __STDC__
- static const double
- #else
- static double
- #endif
- one = 1.0,
- ln2 = 6.93147180559945286227e-01;
- #ifdef __STDC__
- double __ieee754_acosh(double x)
- #else
- double __ieee754_acosh(x)
- double x;
- #endif
- {
- double t;
- int32_t hx;
- u_int32_t lx;
- EXTRACT_WORDS(hx,lx,x);
- if(hx<0x3ff00000) {
- return (x-x)/(x-x);
- } else if(hx >=0x41b00000) {
- if(hx >=0x7ff00000) {
- return x+x;
- } else
- return __ieee754_log(x)+ln2;
- } else if(((hx-0x3ff00000)|lx)==0) {
- return 0.0;
- } else if (hx > 0x40000000) {
- t=x*x;
- return __ieee754_log(2.0*x-one/(x+__ieee754_sqrt(t-one)));
- } else {
- t = x-one;
- return log1p(t+sqrt(2.0*t+t*t));
- }
- }
|