12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879 |
- #include "math.h"
- #include "math_private.h"
- static const double one = 1.0, huge = 1e300;
- static const double zero = 0.0;
- double attribute_hidden __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;
- }
- #ifndef _IEEE_LIBM
- double atanh(double x)
- {
- double z, y;
- z = __ieee754_atanh(x);
- if (_LIB_VERSION == _IEEE_ || isnan(x))
- return z;
- y = fabs(x);
- if (y >= 1.0) {
- if (y > 1.0)
- return __kernel_standard(x, x, 30);
- return __kernel_standard(x, x, 31);
- }
- return z;
- }
- #else
- strong_alias(__ieee754_atanh, atanh)
- #endif
- libm_hidden_def(atanh)
|