123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960 |
- #include "cdefs-compat.h"
- #include <openlibm_math.h>
- #include "math_private.h"
- static const float one = 1.0, half=0.5, huge = 1.0e30;
- DLLEXPORT float
- __ieee754_coshf(float x)
- {
- float t,w;
- int32_t ix;
- GET_FLOAT_WORD(ix,x);
- ix &= 0x7fffffff;
-
- if(ix>=0x7f800000) return x*x;
-
- if(ix<0x3eb17218) {
- t = expm1f(fabsf(x));
- w = one+t;
- if (ix<0x39800000) return one;
- return one+(t*t)/(w+w);
- }
-
- if (ix < 0x41100000) {
- t = __ieee754_expf(fabsf(x));
- return half*t+half/t;
- }
-
- if (ix < 0x42b17217) return half*__ieee754_expf(fabsf(x));
-
- if (ix<=0x42b2d4fc)
- return __ldexp_expf(fabsf(x), -1);
-
- return huge*huge;
- }
|