12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576 |
- #if defined(LIBM_SCCS) && !defined(lint)
- static char rcsid[] = "$NetBSD: e_atanh.c,v 1.8 1995/05/10 20:44:55 jtc Exp $";
- #endif
- #include "math.h"
- #include "math_private.h"
- libm_hidden_proto(log1p)
- #ifdef __STDC__
- static const double one = 1.0, huge = 1e300;
- #else
- static double one = 1.0, huge = 1e300;
- #endif
- #ifdef __STDC__
- static const double zero = 0.0;
- #else
- static double zero = 0.0;
- #endif
- #ifdef __STDC__
- double attribute_hidden __ieee754_atanh(double x)
- #else
- double attribute_hidden __ieee754_atanh(x)
- double x;
- #endif
- {
- 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;
- }
|