1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889 |
- #if defined(LIBM_SCCS) && !defined(lint)
- static char rcsid[] = "$NetBSD: e_sinh.c,v 1.7 1995/05/10 20:46:13 jtc Exp $";
- #endif
- #include "math.h"
- #include "math_private.h"
- libm_hidden_proto(expm1)
- libm_hidden_proto(fabs)
- #ifdef __STDC__
- static const double one = 1.0, shuge = 1.0e307;
- #else
- static double one = 1.0, shuge = 1.0e307;
- #endif
- #ifdef __STDC__
- double attribute_hidden __ieee754_sinh(double x)
- #else
- double attribute_hidden __ieee754_sinh(x)
- double x;
- #endif
- {
- double t,w,h;
- int32_t ix,jx;
- u_int32_t lx;
-
- GET_HIGH_WORD(jx,x);
- ix = jx&0x7fffffff;
-
- if(ix>=0x7ff00000) return x+x;
- h = 0.5;
- if (jx<0) h = -h;
-
- if (ix < 0x40360000) {
- if (ix<0x3e300000)
- if(shuge+x>one) return x;
- t = expm1(fabs(x));
- if(ix<0x3ff00000) return h*(2.0*t-t*t/(t+one));
- return h*(t+t/(t+one));
- }
-
- if (ix < 0x40862E42) return h*__ieee754_exp(fabs(x));
-
- GET_LOW_WORD(lx,x);
- if (ix<0x408633CE || ((ix==0x408633ce)&&(lx<=(u_int32_t)0x8fb9f87d))) {
- w = __ieee754_exp(0.5*fabs(x));
- t = h*w;
- return t*w;
- }
-
- return x*shuge;
- }
|