123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384 |
- #include <openlibm_math.h>
- #include "math_private.h"
- #include "math_private_openbsd.h"
- static const long double one = 1.0, half=0.5, huge = 1.0e4900L;
- long double
- coshl(long double x)
- {
- long double t,w;
- int32_t ex;
- u_int32_t mx,lx;
-
- GET_LDOUBLE_WORDS(ex,mx,lx,x);
- ex &= 0x7fff;
-
- if(ex==0x7fff) return x*x;
-
- if(ex < 0x3ffd || (ex == 0x3ffd && mx < 0xb17217f7u)) {
- t = expm1l(fabsl(x));
- w = one+t;
- if (ex<0x3fbc) return w;
- return one+(t*t)/(w+w);
- }
-
- if (ex < 0x4003 || (ex == 0x4003 && mx < 0xb0000000u)) {
- t = expl(fabsl(x));
- return half*t+half/t;
- }
-
- if (ex < 0x400c || (ex == 0x400c && mx < 0xb1700000u))
- return half*expl(fabsl(x));
-
- if (ex == 0x400c && (mx < 0xb174ddc0u
- || (mx == 0xb174ddc0u && lx < 0x31aec0ebu)))
- {
- w = expl(half*fabsl(x));
- t = half*w;
- return t*w;
- }
-
- return huge*huge;
- }
|