1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465 |
- #if defined(LIBM_SCCS) && !defined(lint)
- static char rcsid[] = "$NetBSD: s_asinh.c,v 1.9 1995/05/12 04:57:37 jtc Exp $";
- #endif
- #include "math.h"
- #include "math_private.h"
- #ifdef __STDC__
- static const double
- #else
- static double
- #endif
- one = 1.00000000000000000000e+00,
- ln2 = 6.93147180559945286227e-01,
- huge= 1.00000000000000000000e+300;
- #ifdef __STDC__
- double asinh(double x)
- #else
- double asinh(x)
- double x;
- #endif
- {
- double t,w;
- int32_t hx,ix;
- GET_HIGH_WORD(hx,x);
- ix = hx&0x7fffffff;
- if(ix>=0x7ff00000) return x+x;
- if(ix< 0x3e300000) {
- if(huge+x>one) return x;
- }
- if(ix>0x41b00000) {
- w = __ieee754_log(fabs(x))+ln2;
- } else if (ix>0x40000000) {
- t = fabs(x);
- w = __ieee754_log(2.0*t+one/(__ieee754_sqrt(x*x+one)+t));
- } else {
- t = x*x;
- w =log1p(fabs(x)+t/(one+__ieee754_sqrt(one+t)));
- }
- if(hx>0) return w; else return -w;
- }
|