version 1.3, 1994/02/18 02:24:59 |
version 1.4, 1994/08/10 20:30:41 |
Line 35 static char rcsid[] = "$Id$"; |
|
Line 35 static char rcsid[] = "$Id$"; |
|
* only cosh(0)=1 is exact for finite x. |
* only cosh(0)=1 is exact for finite x. |
*/ |
*/ |
|
|
#include <math.h> |
#include "math.h" |
|
#include "math_private.h" |
|
|
#ifdef __STDC__ |
#ifdef __STDC__ |
static const double one = 1.0, half=0.5, huge = 1.0e300; |
static const double one = 1.0, half=0.5, huge = 1.0e300; |
Line 55 static double one = 1.0, half=0.5, huge |
|
Line 56 static double one = 1.0, half=0.5, huge |
|
unsigned lx; |
unsigned lx; |
|
|
/* High word of |x|. */ |
/* High word of |x|. */ |
ix = *( (((*(int*)&one)>>29)^1) + (int*)&x); |
GET_HIGH_WORD(ix,x); |
ix &= 0x7fffffff; |
ix &= 0x7fffffff; |
|
|
/* x is INF or NaN */ |
/* x is INF or NaN */ |
Line 79 static double one = 1.0, half=0.5, huge |
|
Line 80 static double one = 1.0, half=0.5, huge |
|
if (ix < 0x40862E42) return half*__ieee754_exp(fabs(x)); |
if (ix < 0x40862E42) return half*__ieee754_exp(fabs(x)); |
|
|
/* |x| in [log(maxdouble), overflowthresold] */ |
/* |x| in [log(maxdouble), overflowthresold] */ |
lx = *( (((*(unsigned*)&one)>>29)) + (unsigned*)&x); |
GET_LOW_WORD(lx,x); |
if (ix<0x408633CE || |
if (ix<0x408633CE || |
(ix==0x408633ce)&&(lx<=(unsigned)0x8fb9f87d)) { |
(ix==0x408633ce)&&(lx<=(unsigned)0x8fb9f87d)) { |
w = __ieee754_exp(half*fabs(x)); |
w = __ieee754_exp(half*fabs(x)); |