Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. =================================================================== RCS file: /ftp/cvs/cvsroot/src/lib/libm/src/s_expm1.c,v rcsdiff: /ftp/cvs/cvsroot/src/lib/libm/src/s_expm1.c,v: warning: Unknown phrases like `commitid ...;' are present. retrieving revision 1.4 retrieving revision 1.5 diff -u -p -r1.4 -r1.5 --- src/lib/libm/src/s_expm1.c 1994/03/03 17:04:33 1.4 +++ src/lib/libm/src/s_expm1.c 1994/08/10 20:32:15 1.5 @@ -11,7 +11,7 @@ */ #ifndef lint -static char rcsid[] = "$Id: s_expm1.c,v 1.4 1994/03/03 17:04:33 jtc Exp $"; +static char rcsid[] = "$Id: s_expm1.c,v 1.5 1994/08/10 20:32:15 jtc Exp $"; #endif /* expm1(x) @@ -109,14 +109,8 @@ static char rcsid[] = "$Id: s_expm1.c,v * to produce the hexadecimal values shown. */ -#include -#include - -#if BYTE_ORDER == LITTLE_ENDIAN -#define n0 1 -#else -#define n0 0 -#endif +#include "math.h" +#include "math_private.h" #ifdef __STDC__ static const double @@ -148,7 +142,7 @@ Q5 = -2.01099218183624371326e-07; /* B int k,xsb; unsigned hx; - hx = *(n0+(unsigned*)&x); /* high word of x */ + GET_HIGH_WORD(hx,x); xsb = hx&0x80000000; /* sign bit of x */ if(xsb==0) y=x; else y= -x; /* y = |x| */ hx &= 0x7fffffff; /* high word of |x| */ @@ -157,7 +151,9 @@ Q5 = -2.01099218183624371326e-07; /* B if(hx >= 0x4043687A) { /* if |x|>=56*ln2 */ if(hx >= 0x40862E42) { /* if |x|>=709.78... */ if(hx>=0x7ff00000) { - if(((hx&0xfffff)|*(1-n0+(int*)&x))!=0) + unsigned int low; + GET_LOW_WORD(low,x); + if(((hx&0xfffff)|low)!=0) return x+x; /* NaN */ else return (xsb==0)? x:-1.0;/* exp(+-inf)={inf,-1} */ } @@ -206,20 +202,26 @@ Q5 = -2.01099218183624371326e-07; /* B if(x < -0.25) return -2.0*(e-(x+0.5)); else return one+2.0*(x-e); if (k <= -2 || k>56) { /* suffice to return exp(x)-1 */ + unsigned int high; y = one-(e-x); - *(n0+(int*)&y) += (k<<20); /* add k to y's exponent */ + GET_HIGH_WORD(high,y); + SET_HIGH_WORD(y,high+(k<<20)); /* add k to y's exponent */ return y-one; } t = one; if(k<20) { - *(n0+(int*)&t) = 0x3ff00000 - (0x200000>>k); /* t=1-2^-k */ + unsigned int high; + SET_HIGH_WORD(t,0x3ff00000 - (0x200000>>k)); /* t=1-2^-k */ y = t-(e-x); - *(n0+(int*)&y) += (k<<20); /* add k to y's exponent */ + GET_HIGH_WORD(high,y); + SET_HIGH_WORD(y,high+(k<<20)); /* add k to y's exponent */ } else { - *(n0+(int*)&t) = ((0x3ff-k)<<20); /* 2^-k */ + unsigned int high; + SET_HIGH_WORD(t,((0x3ff-k)<<20)); /* 2^-k */ y = x-(e+t); y += one; - *(n0+(int*)&y) += (k<<20); /* add k to y's exponent */ + GET_HIGH_WORD(high,y); + SET_HIGH_WORD(y,high+(k<<20)); /* add k to y's exponent */ } } return y;