1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556 |
- #include "math.h"
- #include "math_private.h"
- static const double one = 1.0, huge = 1e300;
- static const double zero = 0.0;
- double __ieee754_atanh(double x)
- {
- double t;
- int32_t hx,ix;
- u_int32_t lx;
- EXTRACT_WORDS(hx,lx,x);
- ix = hx&0x7fffffff;
- if ((ix|((lx|(-lx))>>31))>0x3ff00000)
- return (x-x)/(x-x);
- if(ix==0x3ff00000)
- return x/zero;
- if(ix<0x3e300000&&(huge+x)>zero) return x;
- SET_HIGH_WORD(x,ix);
- if(ix<0x3fe00000) {
- t = x+x;
- t = 0.5*log1p(t+t*x/(one-x));
- } else
- t = 0.5*log1p((x+x)/(one-x));
- if(hx>=0) return t; else return -t;
- }
|