Back to index

lightning-sunbird  0.9+nobinonly
Functions | Variables
e_cosh.c File Reference
#include "fdlibm.h"

Go to the source code of this file.

Functions

double __ieee754_cosh (double x)

Variables

static double one = 1.0
static double half = 0.5
static double really_big = 1.0e300

Function Documentation

double __ieee754_cosh ( double  x)

Definition at line 88 of file e_cosh.c.

{      
        fd_twoints u;
       double t,w;
       int ix;
       unsigned lx;
        
    /* High word of |x|. */
        u.d = x;
       ix = __HI(u);
       ix &= 0x7fffffff;

    /* x is INF or NaN */
       if(ix>=0x7ff00000) return x*x;     

    /* |x| in [0,0.5*ln2], return 1+expm1(|x|)^2/(2*exp(|x|)) */
       if(ix<0x3fd62e43) {
           t = fd_expm1(fd_fabs(x));
           w = one+t;
           if (ix<0x3c800000) return w;   /* cosh(tiny) = 1 */
           return one+(t*t)/(w+w);
       }

    /* |x| in [0.5*ln2,22], return (exp(|x|)+1/exp(|x|)/2; */
       if (ix < 0x40360000) {
              t = __ieee754_exp(fd_fabs(x));
              return half*t+half/t;
       }

    /* |x| in [22, log(maxdouble)] return half*exp(|x|) */
       if (ix < 0x40862E42)  return half*__ieee754_exp(fd_fabs(x));

    /* |x| in [log(maxdouble), overflowthresold] */
       lx = *( (((*(unsigned*)&one)>>29)) + (unsigned*)&x);
       if (ix<0x408633CE || 
             (ix==0x408633ce)&&(lx<=(unsigned)0x8fb9f87d)) {
           w = __ieee754_exp(half*fd_fabs(x));
           t = half*w;
           return t*w;
       }

    /* |x| > overflowthresold, cosh(x) overflow */
       return really_big*really_big;
}

Here is the call graph for this function:

Here is the caller graph for this function:


Variable Documentation

double half = 0.5 [static]

Definition at line 82 of file e_cosh.c.

double one = 1.0 [static]

Definition at line 82 of file e_cosh.c.

double really_big = 1.0e300 [static]

Definition at line 82 of file e_cosh.c.