12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455 |
- #include "math.h"
- #include "math_private.h"
- static const double
- one = 1.0,
- ln2 = 6.93147180559945286227e-01;
- double __ieee754_acosh(double x)
- {
- double t;
- int32_t hx;
- u_int32_t lx;
- EXTRACT_WORDS(hx,lx,x);
- if(hx<0x3ff00000) {
- return (x-x)/(x-x);
- } else if(hx >=0x41b00000) {
- if(hx >=0x7ff00000) {
- return x+x;
- } else
- return __ieee754_log(x)+ln2;
- } else if(((hx-0x3ff00000)|lx)==0) {
- return 0.0;
- } else if (hx > 0x40000000) {
- t=x*x;
- return __ieee754_log(2.0*x-one/(x+__ieee754_sqrt(t-one)));
- } else {
- t = x-one;
- return log1p(t+__ieee754_sqrt(2.0*t+t*t));
- }
- }
|