Change int -> int32_t and unsigned int -> u_int32_t to improve portabilty
to machines where int != 32 bits.
This commit is contained in:
parent
f7c13d44bd
commit
b0c9d09246
|
@ -11,7 +11,7 @@
|
|||
*/
|
||||
|
||||
#ifndef lint
|
||||
static char rcsid[] = "$Id: e_acos.c,v 1.5 1994/08/10 20:30:28 jtc Exp $";
|
||||
static char rcsid[] = "$Id: e_acos.c,v 1.6 1994/08/18 23:04:51 jtc Exp $";
|
||||
#endif
|
||||
|
||||
/* __ieee754_acos(x)
|
||||
|
@ -69,11 +69,11 @@ qS4 = 7.70381505559019352791e-02; /* 0x3FB3B8C5, 0xB12E9282 */
|
|||
#endif
|
||||
{
|
||||
double z,p,q,r,w,s,c,df;
|
||||
int hx,ix;
|
||||
int32_t hx,ix;
|
||||
GET_HIGH_WORD(hx,x);
|
||||
ix = hx&0x7fffffff;
|
||||
if(ix>=0x3ff00000) { /* |x| >= 1 */
|
||||
unsigned int lx;
|
||||
u_int32_t lx;
|
||||
GET_LOW_WORD(lx,x);
|
||||
if(((ix-0x3ff00000)|lx)==0) { /* |x|==1 */
|
||||
if(hx>0) return 0.0; /* acos(1) = 0 */
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
*/
|
||||
|
||||
#ifndef lint
|
||||
static char rcsid[] = "$Id: e_acosf.c,v 1.1 1994/08/10 20:30:29 jtc Exp $";
|
||||
static char rcsid[] = "$Id: e_acosf.c,v 1.2 1994/08/18 23:04:53 jtc Exp $";
|
||||
#endif
|
||||
|
||||
#include "math.h"
|
||||
|
@ -48,7 +48,7 @@ qS4 = 7.7038154006e-02; /* 0x3d9dc62e */
|
|||
#endif
|
||||
{
|
||||
float z,p,q,r,w,s,c,df;
|
||||
int hx,ix;
|
||||
int32_t hx,ix;
|
||||
GET_FLOAT_WORD(hx,x);
|
||||
ix = hx&0x7fffffff;
|
||||
if(ix==0x3f800000) { /* |x|==1 */
|
||||
|
@ -73,7 +73,7 @@ qS4 = 7.7038154006e-02; /* 0x3d9dc62e */
|
|||
w = r*s-pio2_lo;
|
||||
return pi - (float)2.0*(s+w);
|
||||
} else { /* x > 0.5 */
|
||||
int idf;
|
||||
int32_t idf;
|
||||
z = (one-x)*(float)0.5;
|
||||
s = sqrtf(z);
|
||||
df = s;
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
*/
|
||||
|
||||
#ifndef lint
|
||||
static char rcsid[] = "$Id: e_acosh.c,v 1.5 1994/08/10 20:30:31 jtc Exp $";
|
||||
static char rcsid[] = "$Id: e_acosh.c,v 1.6 1994/08/18 23:04:54 jtc Exp $";
|
||||
#endif
|
||||
|
||||
/* __ieee754_acosh(x)
|
||||
|
@ -47,8 +47,8 @@ ln2 = 6.93147180559945286227e-01; /* 0x3FE62E42, 0xFEFA39EF */
|
|||
#endif
|
||||
{
|
||||
double t;
|
||||
int hx;
|
||||
unsigned int lx;
|
||||
int32_t hx;
|
||||
u_int32_t lx;
|
||||
EXTRACT_WORDS(hx,lx,x);
|
||||
if(hx<0x3ff00000) { /* x < 1 */
|
||||
return (x-x)/(x-x);
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
*/
|
||||
|
||||
#ifndef lint
|
||||
static char rcsid[] = "$Id: e_acoshf.c,v 1.1 1994/08/10 20:30:32 jtc Exp $";
|
||||
static char rcsid[] = "$Id: e_acoshf.c,v 1.2 1994/08/18 23:04:57 jtc Exp $";
|
||||
#endif
|
||||
|
||||
#include "math.h"
|
||||
|
@ -36,7 +36,7 @@ ln2 = 6.9314718246e-01; /* 0x3f317218 */
|
|||
#endif
|
||||
{
|
||||
float t;
|
||||
int hx;
|
||||
int32_t hx;
|
||||
GET_FLOAT_WORD(hx,x);
|
||||
if(hx<0x3f800000) { /* x < 1 */
|
||||
return (x-x)/(x-x);
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
*/
|
||||
|
||||
#ifndef lint
|
||||
static char rcsid[] = "$Id: e_asin.c,v 1.5 1994/08/10 20:30:33 jtc Exp $";
|
||||
static char rcsid[] = "$Id: e_asin.c,v 1.6 1994/08/18 23:05:01 jtc Exp $";
|
||||
#endif
|
||||
|
||||
/* __ieee754_asin(x)
|
||||
|
@ -78,11 +78,11 @@ qS4 = 7.70381505559019352791e-02; /* 0x3FB3B8C5, 0xB12E9282 */
|
|||
#endif
|
||||
{
|
||||
double t,w,p,q,c,r,s;
|
||||
int hx,ix;
|
||||
int32_t hx,ix;
|
||||
GET_HIGH_WORD(hx,x);
|
||||
ix = hx&0x7fffffff;
|
||||
if(ix>= 0x3ff00000) { /* |x|>= 1 */
|
||||
unsigned int lx;
|
||||
u_int32_t lx;
|
||||
GET_LOW_WORD(lx,x);
|
||||
if(((ix-0x3ff00000)|lx)==0)
|
||||
/* asin(1)=+-pi/2 with inexact */
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
*/
|
||||
|
||||
#ifndef lint
|
||||
static char rcsid[] = "$Id: e_asinf.c,v 1.1 1994/08/10 20:30:34 jtc Exp $";
|
||||
static char rcsid[] = "$Id: e_asinf.c,v 1.2 1994/08/18 23:05:05 jtc Exp $";
|
||||
#endif
|
||||
|
||||
#include "math.h"
|
||||
|
@ -50,7 +50,7 @@ qS4 = 7.7038154006e-02; /* 0x3d9dc62e */
|
|||
#endif
|
||||
{
|
||||
float t,w,p,q,c,r,s;
|
||||
int hx,ix;
|
||||
int32_t hx,ix;
|
||||
GET_FLOAT_WORD(hx,x);
|
||||
ix = hx&0x7fffffff;
|
||||
if(ix==0x3f800000) {
|
||||
|
@ -78,7 +78,7 @@ qS4 = 7.7038154006e-02; /* 0x3d9dc62e */
|
|||
w = p/q;
|
||||
t = pio2_hi-((float)2.0*(s+s*w)-pio2_lo);
|
||||
} else {
|
||||
int iw;
|
||||
int32_t iw;
|
||||
w = s;
|
||||
GET_FLOAT_WORD(iw,w);
|
||||
SET_FLOAT_WORD(w,iw&0xfffff000);
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
*/
|
||||
|
||||
#ifndef lint
|
||||
static char rcsid[] = "$Id: e_atan2.c,v 1.5 1994/08/10 20:30:35 jtc Exp $";
|
||||
static char rcsid[] = "$Id: e_atan2.c,v 1.6 1994/08/18 23:05:08 jtc Exp $";
|
||||
#endif
|
||||
|
||||
/* __ieee754_atan2(y,x)
|
||||
|
@ -64,8 +64,8 @@ pi_lo = 1.2246467991473531772E-16; /* 0x3CA1A626, 0x33145C07 */
|
|||
#endif
|
||||
{
|
||||
double z;
|
||||
int k,m,hx,hy,ix,iy;
|
||||
unsigned lx,ly;
|
||||
int32_t k,m,hx,hy,ix,iy;
|
||||
u_int32_t lx,ly;
|
||||
|
||||
EXTRACT_WORDS(hx,lx,x);
|
||||
ix = hx&0x7fffffff;
|
||||
|
@ -118,7 +118,7 @@ pi_lo = 1.2246467991473531772E-16; /* 0x3CA1A626, 0x33145C07 */
|
|||
switch (m) {
|
||||
case 0: return z ; /* atan(+,+) */
|
||||
case 1: {
|
||||
unsigned int zh;
|
||||
u_int32_t zh;
|
||||
GET_HIGH_WORD(zh,z);
|
||||
SET_HIGH_WORD(z,zh ^ 0x80000000);
|
||||
}
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
*/
|
||||
|
||||
#ifndef lint
|
||||
static char rcsid[] = "$Id: e_atan2f.c,v 1.1 1994/08/10 20:30:37 jtc Exp $";
|
||||
static char rcsid[] = "$Id: e_atan2f.c,v 1.2 1994/08/18 23:05:11 jtc Exp $";
|
||||
#endif
|
||||
|
||||
#include "math.h"
|
||||
|
@ -40,7 +40,7 @@ pi_lo = 1.5099578832e-07; /* 0x34222168 */
|
|||
#endif
|
||||
{
|
||||
float z;
|
||||
int k,m,hx,hy,ix,iy;
|
||||
int32_t k,m,hx,hy,ix,iy;
|
||||
|
||||
GET_FLOAT_WORD(hx,x);
|
||||
ix = hx&0x7fffffff;
|
||||
|
@ -93,7 +93,7 @@ pi_lo = 1.5099578832e-07; /* 0x34222168 */
|
|||
switch (m) {
|
||||
case 0: return z ; /* atan(+,+) */
|
||||
case 1: {
|
||||
unsigned int zh;
|
||||
u_int32_t zh;
|
||||
GET_FLOAT_WORD(zh,z);
|
||||
SET_FLOAT_WORD(z,zh ^ 0x80000000);
|
||||
}
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
*/
|
||||
|
||||
#ifndef lint
|
||||
static char rcsid[] = "$Id: e_atanh.c,v 1.5 1994/08/10 20:30:38 jtc Exp $";
|
||||
static char rcsid[] = "$Id: e_atanh.c,v 1.6 1994/08/18 23:05:12 jtc Exp $";
|
||||
#endif
|
||||
|
||||
/* __ieee754_atanh(x)
|
||||
|
@ -55,8 +55,8 @@ static double zero = 0.0;
|
|||
#endif
|
||||
{
|
||||
double t;
|
||||
int hx,ix;
|
||||
unsigned lx;
|
||||
int32_t hx,ix;
|
||||
u_int32_t lx;
|
||||
EXTRACT_WORDS(hx,lx,x);
|
||||
ix = hx&0x7fffffff;
|
||||
if ((ix|((lx|(-lx))>>31))>0x3ff00000) /* |x|>1 */
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
*/
|
||||
|
||||
#ifndef lint
|
||||
static char rcsid[] = "$Id: e_atanhf.c,v 1.1 1994/08/10 20:30:39 jtc Exp $";
|
||||
static char rcsid[] = "$Id: e_atanhf.c,v 1.2 1994/08/18 23:05:14 jtc Exp $";
|
||||
#endif
|
||||
|
||||
#include "math.h"
|
||||
|
@ -40,7 +40,7 @@ static float zero = 0.0;
|
|||
#endif
|
||||
{
|
||||
float t;
|
||||
int hx,ix;
|
||||
int32_t hx,ix;
|
||||
GET_FLOAT_WORD(hx,x);
|
||||
ix = hx&0x7fffffff;
|
||||
if (ix>0x3f800000) /* |x|>1 */
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
*/
|
||||
|
||||
#ifndef lint
|
||||
static char rcsid[] = "$Id: e_cosh.c,v 1.4 1994/08/10 20:30:41 jtc Exp $";
|
||||
static char rcsid[] = "$Id: e_cosh.c,v 1.5 1994/08/18 23:05:15 jtc Exp $";
|
||||
#endif
|
||||
|
||||
/* __ieee754_cosh(x)
|
||||
|
@ -52,8 +52,8 @@ static double one = 1.0, half=0.5, huge = 1.0e300;
|
|||
#endif
|
||||
{
|
||||
double t,w;
|
||||
int ix;
|
||||
unsigned lx;
|
||||
int32_t ix;
|
||||
u_int32_t lx;
|
||||
|
||||
/* High word of |x|. */
|
||||
GET_HIGH_WORD(ix,x);
|
||||
|
@ -82,7 +82,7 @@ static double one = 1.0, half=0.5, huge = 1.0e300;
|
|||
/* |x| in [log(maxdouble), overflowthresold] */
|
||||
GET_LOW_WORD(lx,x);
|
||||
if (ix<0x408633CE ||
|
||||
(ix==0x408633ce)&&(lx<=(unsigned)0x8fb9f87d)) {
|
||||
(ix==0x408633ce)&&(lx<=(u_int32_t)0x8fb9f87d)) {
|
||||
w = __ieee754_exp(half*fabs(x));
|
||||
t = half*w;
|
||||
return t*w;
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
*/
|
||||
|
||||
#ifndef lint
|
||||
static char rcsid[] = "$Id: e_coshf.c,v 1.1 1994/08/10 20:30:42 jtc Exp $";
|
||||
static char rcsid[] = "$Id: e_coshf.c,v 1.2 1994/08/18 23:05:17 jtc Exp $";
|
||||
#endif
|
||||
|
||||
#include "math.h"
|
||||
|
@ -34,7 +34,7 @@ static float one = 1.0, half=0.5, huge = 1.0e30;
|
|||
#endif
|
||||
{
|
||||
float t,w;
|
||||
int ix;
|
||||
int32_t ix;
|
||||
|
||||
GET_FLOAT_WORD(ix,x);
|
||||
ix &= 0x7fffffff;
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
*/
|
||||
|
||||
#ifndef lint
|
||||
static char rcsid[] = "$Id: e_exp.c,v 1.5 1994/08/10 20:30:44 jtc Exp $";
|
||||
static char rcsid[] = "$Id: e_exp.c,v 1.6 1994/08/18 23:05:18 jtc Exp $";
|
||||
#endif
|
||||
|
||||
/* __ieee754_exp(x)
|
||||
|
@ -111,8 +111,8 @@ P5 = 4.13813679705723846039e-08; /* 0x3E663769, 0x72BEA4D0 */
|
|||
#endif
|
||||
{
|
||||
double y,hi,lo,c,t;
|
||||
int k,xsb;
|
||||
unsigned hx;
|
||||
int32_t k,xsb;
|
||||
u_int32_t hx;
|
||||
|
||||
GET_HIGH_WORD(hx,x);
|
||||
xsb = (hx>>31)&1; /* sign bit of x */
|
||||
|
@ -121,7 +121,7 @@ P5 = 4.13813679705723846039e-08; /* 0x3E663769, 0x72BEA4D0 */
|
|||
/* filter out non-finite argument */
|
||||
if(hx >= 0x40862E42) { /* if |x|>=709.78... */
|
||||
if(hx>=0x7ff00000) {
|
||||
unsigned int lx;
|
||||
u_int32_t lx;
|
||||
GET_LOW_WORD(lx,x);
|
||||
if(((hx&0xfffff)|lx)!=0)
|
||||
return x+x; /* NaN */
|
||||
|
@ -154,12 +154,12 @@ P5 = 4.13813679705723846039e-08; /* 0x3E663769, 0x72BEA4D0 */
|
|||
if(k==0) return one-((x*c)/(c-2.0)-x);
|
||||
else y = one-((lo-(x*c)/(2.0-c))-hi);
|
||||
if(k >= -1021) {
|
||||
unsigned int hy;
|
||||
u_int32_t hy;
|
||||
GET_HIGH_WORD(hy,y);
|
||||
SET_HIGH_WORD(y,hy+(k<<20)); /* add k to y's exponent */
|
||||
return y;
|
||||
} else {
|
||||
unsigned int hy;
|
||||
u_int32_t hy;
|
||||
GET_HIGH_WORD(hy,y);
|
||||
SET_HIGH_WORD(y,hy+((k+1000)<<20)); /* add k to y's exponent */
|
||||
return y*twom1000;
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
*/
|
||||
|
||||
#ifndef lint
|
||||
static char rcsid[] = "$Id: e_expf.c,v 1.1 1994/08/10 20:30:46 jtc Exp $";
|
||||
static char rcsid[] = "$Id: e_expf.c,v 1.2 1994/08/18 23:05:20 jtc Exp $";
|
||||
#endif
|
||||
|
||||
#include "math.h"
|
||||
|
@ -50,8 +50,8 @@ P5 = 4.1381369442e-08; /* 0x3331bb4c */
|
|||
#endif
|
||||
{
|
||||
float y,hi,lo,c,t;
|
||||
int k,xsb;
|
||||
unsigned hx;
|
||||
int32_t k,xsb;
|
||||
u_int32_t hx;
|
||||
|
||||
GET_FLOAT_WORD(hx,x);
|
||||
xsb = (hx>>31)&1; /* sign bit of x */
|
||||
|
@ -90,12 +90,12 @@ P5 = 4.1381369442e-08; /* 0x3331bb4c */
|
|||
if(k==0) return one-((x*c)/(c-(float)2.0)-x);
|
||||
else y = one-((lo-(x*c)/((float)2.0-c))-hi);
|
||||
if(k >= -125) {
|
||||
unsigned int hy;
|
||||
u_int32_t hy;
|
||||
GET_FLOAT_WORD(hy,y);
|
||||
SET_FLOAT_WORD(y,hy+(k<<23)); /* add k to y's exponent */
|
||||
return y;
|
||||
} else {
|
||||
unsigned int hy;
|
||||
u_int32_t hy;
|
||||
GET_FLOAT_WORD(hy,y);
|
||||
SET_FLOAT_WORD(y,hy+((k+100)<<23)); /* add k to y's exponent */
|
||||
return y*twom100;
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
*/
|
||||
|
||||
#ifndef lint
|
||||
static char rcsid[] = "$Id: e_fmod.c,v 1.5 1994/08/10 20:30:47 jtc Exp $";
|
||||
static char rcsid[] = "$Id: e_fmod.c,v 1.6 1994/08/18 23:05:21 jtc Exp $";
|
||||
#endif
|
||||
|
||||
/*
|
||||
|
@ -36,8 +36,8 @@ static double one = 1.0, Zero[] = {0.0, -0.0,};
|
|||
double x,y ;
|
||||
#endif
|
||||
{
|
||||
int n,hx,hy,hz,ix,iy,sx,i;
|
||||
unsigned lx,ly,lz;
|
||||
int32_t n,hx,hy,hz,ix,iy,sx,i;
|
||||
u_int32_t lx,ly,lz;
|
||||
|
||||
EXTRACT_WORDS(hx,lx,x);
|
||||
EXTRACT_WORDS(hy,ly,y);
|
||||
|
@ -52,7 +52,7 @@ static double one = 1.0, Zero[] = {0.0, -0.0,};
|
|||
if(hx<=hy) {
|
||||
if((hx<hy)||(lx<ly)) return x; /* |x|<|y| return x */
|
||||
if(lx==ly)
|
||||
return Zero[(unsigned)sx>>31]; /* |x|=|y| return x*0*/
|
||||
return Zero[(u_int32_t)sx>>31]; /* |x|=|y| return x*0*/
|
||||
}
|
||||
|
||||
/* determine ix = ilogb(x) */
|
||||
|
@ -106,7 +106,7 @@ static double one = 1.0, Zero[] = {0.0, -0.0,};
|
|||
if(hz<0){hx = hx+hx+(lx>>31); lx = lx+lx;}
|
||||
else {
|
||||
if((hz|lz)==0) /* return sign(x)*0 */
|
||||
return Zero[(unsigned)sx>>31];
|
||||
return Zero[(u_int32_t)sx>>31];
|
||||
hx = hz+hz+(lz>>31); lx = lz+lz;
|
||||
}
|
||||
}
|
||||
|
@ -115,7 +115,7 @@ static double one = 1.0, Zero[] = {0.0, -0.0,};
|
|||
|
||||
/* convert back to floating value and restore the sign */
|
||||
if((hx|lx)==0) /* return sign(x)*0 */
|
||||
return Zero[(unsigned)sx>>31];
|
||||
return Zero[(u_int32_t)sx>>31];
|
||||
while(hx<0x00100000) { /* normalize x */
|
||||
hx = hx+hx+(lx>>31); lx = lx+lx;
|
||||
iy -= 1;
|
||||
|
@ -126,7 +126,7 @@ static double one = 1.0, Zero[] = {0.0, -0.0,};
|
|||
} else { /* subnormal output */
|
||||
n = -1022 - iy;
|
||||
if(n<=20) {
|
||||
lx = (lx>>n)|((unsigned)hx<<(32-n));
|
||||
lx = (lx>>n)|((u_int32_t)hx<<(32-n));
|
||||
hx >>= n;
|
||||
} else if (n<=31) {
|
||||
lx = (hx<<(32-n))|(lx>>n); hx = sx;
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
*/
|
||||
|
||||
#ifndef lint
|
||||
static char rcsid[] = "$Id: e_fmodf.c,v 1.1 1994/08/10 20:30:48 jtc Exp $";
|
||||
static char rcsid[] = "$Id: e_fmodf.c,v 1.2 1994/08/18 23:05:23 jtc Exp $";
|
||||
#endif
|
||||
|
||||
/*
|
||||
|
@ -39,7 +39,7 @@ static float one = 1.0, Zero[] = {0.0, -0.0,};
|
|||
float x,y ;
|
||||
#endif
|
||||
{
|
||||
int n,hx,hy,hz,ix,iy,sx,i;
|
||||
int32_t n,hx,hy,hz,ix,iy,sx,i;
|
||||
|
||||
GET_FLOAT_WORD(hx,x);
|
||||
GET_FLOAT_WORD(hy,y);
|
||||
|
@ -53,7 +53,7 @@ static float one = 1.0, Zero[] = {0.0, -0.0,};
|
|||
return (x*y)/(x*y);
|
||||
if(hx<hy) return x; /* |x|<|y| return x */
|
||||
if(hx==hy)
|
||||
return Zero[(unsigned)sx>>31]; /* |x|=|y| return x*0*/
|
||||
return Zero[(u_int32_t)sx>>31]; /* |x|=|y| return x*0*/
|
||||
|
||||
/* determine ix = ilogb(x) */
|
||||
if(hx<0x00800000) { /* subnormal x */
|
||||
|
@ -86,7 +86,7 @@ static float one = 1.0, Zero[] = {0.0, -0.0,};
|
|||
if(hz<0){hx = hx+hx;}
|
||||
else {
|
||||
if(hz==0) /* return sign(x)*0 */
|
||||
return Zero[(unsigned)sx>>31];
|
||||
return Zero[(u_int32_t)sx>>31];
|
||||
hx = hz+hz;
|
||||
}
|
||||
}
|
||||
|
@ -95,7 +95,7 @@ static float one = 1.0, Zero[] = {0.0, -0.0,};
|
|||
|
||||
/* convert back to floating value and restore the sign */
|
||||
if(hx==0) /* return sign(x)*0 */
|
||||
return Zero[(unsigned)sx>>31];
|
||||
return Zero[(u_int32_t)sx>>31];
|
||||
while(hx<0x00800000) { /* normalize x */
|
||||
hx = hx+hx;
|
||||
iy -= 1;
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
*/
|
||||
|
||||
#ifndef lint
|
||||
static char rcsid[] = "$Id: e_hypot.c,v 1.5 1994/08/10 20:30:55 jtc Exp $";
|
||||
static char rcsid[] = "$Id: e_hypot.c,v 1.6 1994/08/18 23:05:24 jtc Exp $";
|
||||
#endif
|
||||
|
||||
/* __ieee754_hypot(x,y)
|
||||
|
@ -57,7 +57,7 @@ static char rcsid[] = "$Id: e_hypot.c,v 1.5 1994/08/10 20:30:55 jtc Exp $";
|
|||
#endif
|
||||
{
|
||||
double a=x,b=y,t1,t2,y1,y2,w;
|
||||
int j,k,ha,hb;
|
||||
int32_t j,k,ha,hb;
|
||||
|
||||
GET_HIGH_WORD(ha,x);
|
||||
ha &= 0x7fffffff;
|
||||
|
@ -70,7 +70,7 @@ static char rcsid[] = "$Id: e_hypot.c,v 1.5 1994/08/10 20:30:55 jtc Exp $";
|
|||
k=0;
|
||||
if(ha > 0x5f300000) { /* a>2**500 */
|
||||
if(ha >= 0x7ff00000) { /* Inf or NaN */
|
||||
unsigned int low;
|
||||
u_int32_t low;
|
||||
w = a+b; /* for sNaN */
|
||||
GET_LOW_WORD(low,a);
|
||||
if(((ha&0xfffff)|low)==0) w = a;
|
||||
|
@ -85,7 +85,7 @@ static char rcsid[] = "$Id: e_hypot.c,v 1.5 1994/08/10 20:30:55 jtc Exp $";
|
|||
}
|
||||
if(hb < 0x20b00000) { /* b < 2**-500 */
|
||||
if(hb <= 0x000fffff) { /* subnormal b or 0 */
|
||||
unsigned int low;
|
||||
u_int32_t low;
|
||||
GET_LOW_WORD(low,b);
|
||||
if((hb|low)==0) return a;
|
||||
t1=0;
|
||||
|
@ -119,7 +119,7 @@ static char rcsid[] = "$Id: e_hypot.c,v 1.5 1994/08/10 20:30:55 jtc Exp $";
|
|||
w = sqrt(t1*y1-(w*(-w)-(t1*y2+t2*b)));
|
||||
}
|
||||
if(k!=0) {
|
||||
unsigned int high;
|
||||
u_int32_t high;
|
||||
t1 = 1.0;
|
||||
GET_HIGH_WORD(high,t1);
|
||||
SET_HIGH_WORD(t1,high+(k<<20));
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
*/
|
||||
|
||||
#ifndef lint
|
||||
static char rcsid[] = "$Id: e_hypotf.c,v 1.1 1994/08/10 20:30:57 jtc Exp $";
|
||||
static char rcsid[] = "$Id: e_hypotf.c,v 1.2 1994/08/18 23:05:26 jtc Exp $";
|
||||
#endif
|
||||
|
||||
#include "math.h"
|
||||
|
@ -28,7 +28,7 @@ static char rcsid[] = "$Id: e_hypotf.c,v 1.1 1994/08/10 20:30:57 jtc Exp $";
|
|||
#endif
|
||||
{
|
||||
float a=x,b=y,t1,t2,y1,y2,w;
|
||||
int j,k,ha,hb;
|
||||
int32_t j,k,ha,hb;
|
||||
|
||||
GET_FLOAT_WORD(ha,x);
|
||||
ha &= 0x7fffffff;
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
*/
|
||||
|
||||
#ifndef lint
|
||||
static char rcsid[] = "$Id: e_j0.c,v 1.5 1994/08/10 20:30:58 jtc Exp $";
|
||||
static char rcsid[] = "$Id: e_j0.c,v 1.6 1994/08/18 23:05:29 jtc Exp $";
|
||||
#endif
|
||||
|
||||
/* __ieee754_j0(x), __ieee754_y0(x)
|
||||
|
@ -101,7 +101,7 @@ static double zero = 0.0;
|
|||
#endif
|
||||
{
|
||||
double z, s,c,ss,cc,r,u,v;
|
||||
int hx,ix;
|
||||
int32_t hx,ix;
|
||||
|
||||
GET_HIGH_WORD(hx,x);
|
||||
ix = hx&0x7fffffff;
|
||||
|
@ -170,7 +170,7 @@ v04 = 4.41110311332675467403e-10; /* 0x3DFE5018, 0x3BD6D9EF */
|
|||
#endif
|
||||
{
|
||||
double z, s,c,ss,cc,u,v;
|
||||
int hx,ix,lx;
|
||||
int32_t hx,ix,lx;
|
||||
|
||||
EXTRACT_WORDS(hx,lx,x);
|
||||
ix = 0x7fffffff&hx;
|
||||
|
@ -337,7 +337,7 @@ static double pS2[5] = {
|
|||
double *p,*q;
|
||||
#endif
|
||||
double z,r,s;
|
||||
int ix;
|
||||
int32_t ix;
|
||||
GET_HIGH_WORD(ix,x);
|
||||
ix &= 0x7fffffff;
|
||||
if(ix>=0x40200000) {p = pR8; q= pS8;}
|
||||
|
@ -473,7 +473,7 @@ static double qS2[6] = {
|
|||
double *p,*q;
|
||||
#endif
|
||||
double s,r,z;
|
||||
int ix;
|
||||
int32_t ix;
|
||||
GET_HIGH_WORD(ix,x);
|
||||
ix &= 0x7fffffff;
|
||||
if(ix>=0x40200000) {p = qR8; q= qS8;}
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
*/
|
||||
|
||||
#ifndef lint
|
||||
static char rcsid[] = "$Id: e_j0f.c,v 1.1 1994/08/10 20:30:59 jtc Exp $";
|
||||
static char rcsid[] = "$Id: e_j0f.c,v 1.2 1994/08/18 23:05:32 jtc Exp $";
|
||||
#endif
|
||||
|
||||
#include "math.h"
|
||||
|
@ -59,7 +59,7 @@ static float zero = 0.0;
|
|||
#endif
|
||||
{
|
||||
float z, s,c,ss,cc,r,u,v;
|
||||
int hx,ix;
|
||||
int32_t hx,ix;
|
||||
|
||||
GET_FLOAT_WORD(hx,x);
|
||||
ix = hx&0x7fffffff;
|
||||
|
@ -128,7 +128,7 @@ v04 = 4.4111031494e-10; /* 0x2ff280c2 */
|
|||
#endif
|
||||
{
|
||||
float z, s,c,ss,cc,u,v;
|
||||
int hx,ix;
|
||||
int32_t hx,ix;
|
||||
|
||||
GET_FLOAT_WORD(hx,x);
|
||||
ix = 0x7fffffff&hx;
|
||||
|
@ -294,7 +294,7 @@ static float pS2[5] = {
|
|||
float *p,*q;
|
||||
#endif
|
||||
float z,r,s;
|
||||
int ix;
|
||||
int32_t ix;
|
||||
GET_FLOAT_WORD(ix,x);
|
||||
ix &= 0x7fffffff;
|
||||
if(ix>=0x41000000) {p = pR8; q= pS8;}
|
||||
|
@ -430,7 +430,7 @@ static float qS2[6] = {
|
|||
float *p,*q;
|
||||
#endif
|
||||
float s,r,z;
|
||||
int ix;
|
||||
int32_t ix;
|
||||
GET_FLOAT_WORD(ix,x);
|
||||
ix &= 0x7fffffff;
|
||||
if(ix>=0x41000000) {p = qR8; q= qS8;}
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
*/
|
||||
|
||||
#ifndef lint
|
||||
static char rcsid[] = "$Id: e_j1.c,v 1.5 1994/08/10 20:31:01 jtc Exp $";
|
||||
static char rcsid[] = "$Id: e_j1.c,v 1.6 1994/08/18 23:05:33 jtc Exp $";
|
||||
#endif
|
||||
|
||||
/* __ieee754_j1(x), __ieee754_y1(x)
|
||||
|
@ -102,7 +102,7 @@ static double zero = 0.0;
|
|||
#endif
|
||||
{
|
||||
double z, s,c,ss,cc,r,u,v,y;
|
||||
int hx,ix;
|
||||
int32_t hx,ix;
|
||||
|
||||
GET_HIGH_WORD(hx,x);
|
||||
ix = hx&0x7fffffff;
|
||||
|
@ -171,7 +171,7 @@ static double V0[5] = {
|
|||
#endif
|
||||
{
|
||||
double z, s,c,ss,cc,u,v;
|
||||
int hx,ix,lx;
|
||||
int32_t hx,ix,lx;
|
||||
|
||||
EXTRACT_WORDS(hx,lx,x);
|
||||
ix = 0x7fffffff&hx;
|
||||
|
@ -335,7 +335,7 @@ static double ps2[5] = {
|
|||
double *p,*q;
|
||||
#endif
|
||||
double z,r,s;
|
||||
int ix;
|
||||
int32_t ix;
|
||||
GET_HIGH_WORD(ix,x);
|
||||
ix &= 0x7fffffff;
|
||||
if(ix>=0x40200000) {p = pr8; q= ps8;}
|
||||
|
@ -472,7 +472,7 @@ static double qs2[6] = {
|
|||
double *p,*q;
|
||||
#endif
|
||||
double s,r,z;
|
||||
int ix;
|
||||
int32_t ix;
|
||||
GET_HIGH_WORD(ix,x);
|
||||
ix &= 0x7fffffff;
|
||||
if(ix>=0x40200000) {p = qr8; q= qs8;}
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
*/
|
||||
|
||||
#ifndef lint
|
||||
static char rcsid[] = "$Id: e_j1f.c,v 1.1 1994/08/10 20:31:02 jtc Exp $";
|
||||
static char rcsid[] = "$Id: e_j1f.c,v 1.2 1994/08/18 23:05:35 jtc Exp $";
|
||||
#endif
|
||||
|
||||
#include "math.h"
|
||||
|
@ -60,7 +60,7 @@ static float zero = 0.0;
|
|||
#endif
|
||||
{
|
||||
float z, s,c,ss,cc,r,u,v,y;
|
||||
int hx,ix;
|
||||
int32_t hx,ix;
|
||||
|
||||
GET_FLOAT_WORD(hx,x);
|
||||
ix = hx&0x7fffffff;
|
||||
|
@ -129,7 +129,7 @@ static float V0[5] = {
|
|||
#endif
|
||||
{
|
||||
float z, s,c,ss,cc,u,v;
|
||||
int hx,ix;
|
||||
int32_t hx,ix;
|
||||
|
||||
GET_FLOAT_WORD(hx,x);
|
||||
ix = 0x7fffffff&hx;
|
||||
|
@ -293,7 +293,7 @@ static float ps2[5] = {
|
|||
float *p,*q;
|
||||
#endif
|
||||
float z,r,s;
|
||||
int ix;
|
||||
int32_t ix;
|
||||
GET_FLOAT_WORD(ix,x);
|
||||
ix &= 0x7fffffff;
|
||||
if(ix>=0x41000000) {p = pr8; q= ps8;}
|
||||
|
@ -430,7 +430,7 @@ static float qs2[6] = {
|
|||
float *p,*q;
|
||||
#endif
|
||||
float s,r,z;
|
||||
int ix;
|
||||
int32_t ix;
|
||||
GET_FLOAT_WORD(ix,x);
|
||||
ix &= 0x7fffffff;
|
||||
if(ix>=0x40200000) {p = qr8; q= qs8;}
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
*/
|
||||
|
||||
#ifndef lint
|
||||
static char rcsid[] = "$Id: e_jn.c,v 1.5 1994/08/10 20:31:03 jtc Exp $";
|
||||
static char rcsid[] = "$Id: e_jn.c,v 1.6 1994/08/18 23:05:37 jtc Exp $";
|
||||
#endif
|
||||
|
||||
/*
|
||||
|
@ -65,7 +65,7 @@ static double zero = 0.00000000000000000000e+00;
|
|||
int n; double x;
|
||||
#endif
|
||||
{
|
||||
int i,hx,ix,lx, sgn;
|
||||
int32_t i,hx,ix,lx, sgn;
|
||||
double a, b, temp, di;
|
||||
double z, w;
|
||||
|
||||
|
@ -75,7 +75,7 @@ static double zero = 0.00000000000000000000e+00;
|
|||
EXTRACT_WORDS(hx,lx,x);
|
||||
ix = 0x7fffffff&hx;
|
||||
/* if J(n,NaN) is NaN */
|
||||
if((ix|((unsigned)(lx|-lx))>>31)>0x7ff00000) return x+x;
|
||||
if((ix|((u_int32_t)(lx|-lx))>>31)>0x7ff00000) return x+x;
|
||||
if(n<0){
|
||||
n = -n;
|
||||
x = -x;
|
||||
|
@ -165,7 +165,7 @@ static double zero = 0.00000000000000000000e+00;
|
|||
*/
|
||||
/* determine k */
|
||||
double t,v;
|
||||
double q0,q1,h,tmp; int k,m;
|
||||
double q0,q1,h,tmp; int32_t k,m;
|
||||
w = (n+n)/(double)x; h = 2.0/(double)x;
|
||||
q0 = w; z = w+h; q1 = w*z - 1.0; k=1;
|
||||
while(q1<1.0e9) {
|
||||
|
@ -225,14 +225,14 @@ static double zero = 0.00000000000000000000e+00;
|
|||
int n; double x;
|
||||
#endif
|
||||
{
|
||||
int i,hx,ix,lx;
|
||||
int sign;
|
||||
int32_t i,hx,ix,lx;
|
||||
int32_t sign;
|
||||
double a, b, temp;
|
||||
|
||||
EXTRACT_WORDS(hx,lx,x);
|
||||
ix = 0x7fffffff&hx;
|
||||
/* if Y(n,NaN) is NaN */
|
||||
if((ix|((unsigned)(lx|-lx))>>31)>0x7ff00000) return x+x;
|
||||
if((ix|((u_int32_t)(lx|-lx))>>31)>0x7ff00000) return x+x;
|
||||
if((ix|lx)==0) return -one/zero;
|
||||
if(hx<0) return zero/zero;
|
||||
sign = 1;
|
||||
|
@ -265,7 +265,7 @@ static double zero = 0.00000000000000000000e+00;
|
|||
}
|
||||
b = invsqrtpi*temp/sqrt(x);
|
||||
} else {
|
||||
unsigned int high;
|
||||
u_int32_t high;
|
||||
a = __ieee754_y0(x);
|
||||
b = __ieee754_y1(x);
|
||||
/* quit if b is -inf */
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
*/
|
||||
|
||||
#ifndef lint
|
||||
static char rcsid[] = "$Id: e_jnf.c,v 1.1 1994/08/10 20:31:04 jtc Exp $";
|
||||
static char rcsid[] = "$Id: e_jnf.c,v 1.2 1994/08/18 23:05:39 jtc Exp $";
|
||||
#endif
|
||||
|
||||
#include "math.h"
|
||||
|
@ -42,7 +42,7 @@ static float zero = 0.0000000000e+00;
|
|||
int n; float x;
|
||||
#endif
|
||||
{
|
||||
int i,hx,ix, sgn;
|
||||
int32_t i,hx,ix, sgn;
|
||||
float a, b, temp, di;
|
||||
float z, w;
|
||||
|
||||
|
@ -119,7 +119,7 @@ static float zero = 0.0000000000e+00;
|
|||
*/
|
||||
/* determine k */
|
||||
float t,v;
|
||||
float q0,q1,h,tmp; int k,m;
|
||||
float q0,q1,h,tmp; int32_t k,m;
|
||||
w = (n+n)/(float)x; h = (float)2.0/(float)x;
|
||||
q0 = w; z = w+h; q1 = w*z - (float)1.0; k=1;
|
||||
while(q1<(float)1.0e9) {
|
||||
|
@ -179,8 +179,8 @@ static float zero = 0.0000000000e+00;
|
|||
int n; float x;
|
||||
#endif
|
||||
{
|
||||
int i,hx,ix,ib;
|
||||
int sign;
|
||||
int32_t i,hx,ix,ib;
|
||||
int32_t sign;
|
||||
float a, b, temp;
|
||||
|
||||
GET_FLOAT_WORD(hx,x);
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
*/
|
||||
|
||||
#ifndef lint
|
||||
static char rcsid[] = "$Id: e_log.c,v 1.5 1994/08/10 20:31:10 jtc Exp $";
|
||||
static char rcsid[] = "$Id: e_log.c,v 1.6 1994/08/18 23:05:41 jtc Exp $";
|
||||
#endif
|
||||
|
||||
/* __ieee754_log(x)
|
||||
|
@ -98,8 +98,8 @@ static double zero = 0.0;
|
|||
#endif
|
||||
{
|
||||
double hfsq,f,s,z,R,w,t1,t2,dk;
|
||||
int k,hx,i,j;
|
||||
unsigned lx;
|
||||
int32_t k,hx,i,j;
|
||||
u_int32_t lx;
|
||||
|
||||
EXTRACT_WORDS(hx,lx,x);
|
||||
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
*/
|
||||
|
||||
#ifndef lint
|
||||
static char rcsid[] = "$Id: e_log10.c,v 1.5 1994/08/10 20:31:12 jtc Exp $";
|
||||
static char rcsid[] = "$Id: e_log10.c,v 1.6 1994/08/18 23:05:44 jtc Exp $";
|
||||
#endif
|
||||
|
||||
/* __ieee754_log10(x)
|
||||
|
@ -75,8 +75,8 @@ static double zero = 0.0;
|
|||
#endif
|
||||
{
|
||||
double y,z;
|
||||
int i,k,hx;
|
||||
unsigned lx;
|
||||
int32_t i,k,hx;
|
||||
u_int32_t lx;
|
||||
|
||||
EXTRACT_WORDS(hx,lx,x);
|
||||
|
||||
|
@ -90,7 +90,7 @@ static double zero = 0.0;
|
|||
}
|
||||
if (hx >= 0x7ff00000) return x+x;
|
||||
k += (hx>>20)-1023;
|
||||
i = ((unsigned)k&0x80000000)>>31;
|
||||
i = ((u_int32_t)k&0x80000000)>>31;
|
||||
hx = (hx&0x000fffff)|((0x3ff-i)<<20);
|
||||
y = (double)(k+i);
|
||||
SET_HIGH_WORD(x,hx);
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
*/
|
||||
|
||||
#ifndef lint
|
||||
static char rcsid[] = "$Id: e_log10f.c,v 1.1 1994/08/10 20:31:13 jtc Exp $";
|
||||
static char rcsid[] = "$Id: e_log10f.c,v 1.2 1994/08/18 23:05:46 jtc Exp $";
|
||||
#endif
|
||||
|
||||
#include "math.h"
|
||||
|
@ -45,7 +45,7 @@ static float zero = 0.0;
|
|||
#endif
|
||||
{
|
||||
float y,z;
|
||||
int i,k,hx;
|
||||
int32_t i,k,hx;
|
||||
|
||||
GET_FLOAT_WORD(hx,x);
|
||||
|
||||
|
@ -59,7 +59,7 @@ static float zero = 0.0;
|
|||
}
|
||||
if (hx >= 0x7f800000) return x+x;
|
||||
k += (hx>>23)-127;
|
||||
i = ((unsigned)k&0x80000000)>>31;
|
||||
i = ((u_int32_t)k&0x80000000)>>31;
|
||||
hx = (hx&0x007fffff)|((0x7f-i)<<23);
|
||||
y = (float)(k+i);
|
||||
SET_FLOAT_WORD(x,hx);
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
*/
|
||||
|
||||
#ifndef lint
|
||||
static char rcsid[] = "$Id: e_logf.c,v 1.1 1994/08/10 20:31:14 jtc Exp $";
|
||||
static char rcsid[] = "$Id: e_logf.c,v 1.2 1994/08/18 23:05:48 jtc Exp $";
|
||||
#endif
|
||||
|
||||
#include "math.h"
|
||||
|
@ -50,7 +50,7 @@ static float zero = 0.0;
|
|||
#endif
|
||||
{
|
||||
float hfsq,f,s,z,R,w,t1,t2,dk;
|
||||
int k,ix,i,j;
|
||||
int32_t k,ix,i,j;
|
||||
|
||||
GET_FLOAT_WORD(ix,x);
|
||||
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
*/
|
||||
|
||||
#ifndef lint
|
||||
static char rcsid[] = "$Id: e_pow.c,v 1.4 1994/08/10 20:31:16 jtc Exp $";
|
||||
static char rcsid[] = "$Id: e_pow.c,v 1.5 1994/08/18 23:05:51 jtc Exp $";
|
||||
#endif
|
||||
|
||||
/* __ieee754_pow(x,y) return x**y
|
||||
|
@ -108,9 +108,9 @@ ivln2_l = 1.92596299112661746887e-08; /* 0x3E54AE0B, 0xF85DDF44 =1/ln2 tail*/
|
|||
{
|
||||
double z,ax,z_h,z_l,p_h,p_l;
|
||||
double y1,t1,t2,r,s,t,u,v,w;
|
||||
int i,j,k,yisint,n;
|
||||
int hx,hy,ix,iy;
|
||||
unsigned lx,ly;
|
||||
int32_t i,j,k,yisint,n;
|
||||
int32_t hx,hy,ix,iy;
|
||||
u_int32_t lx,ly;
|
||||
|
||||
EXTRACT_WORDS(hx,lx,x);
|
||||
EXTRACT_WORDS(hy,ly,y);
|
||||
|
@ -185,7 +185,7 @@ ivln2_l = 1.92596299112661746887e-08; /* 0x3E54AE0B, 0xF85DDF44 =1/ln2 tail*/
|
|||
if((((hx>>31)+1)|yisint)==0) return (x-x)/(x-x);
|
||||
but ANSI C says a right shift of a signed negative quantity is
|
||||
implementation defined. */
|
||||
if(((((unsigned)hx>>31)-1)|yisint)==0) return (x-x)/(x-x);
|
||||
if(((((u_int32_t)hx>>31)-1)|yisint)==0) return (x-x)/(x-x);
|
||||
|
||||
/* |y| is huge */
|
||||
if(iy>0x41e00000) { /* if |y| > 2**31 */
|
||||
|
@ -256,7 +256,7 @@ ivln2_l = 1.92596299112661746887e-08; /* 0x3E54AE0B, 0xF85DDF44 =1/ln2 tail*/
|
|||
}
|
||||
|
||||
s = one; /* s (sign of result -ve**odd) = -1 else = 1 */
|
||||
if(((((unsigned)hx>>31)-1)|(yisint-1))==0)
|
||||
if(((((u_int32_t)hx>>31)-1)|(yisint-1))==0)
|
||||
s = -one;/* (-ve)**(odd int) */
|
||||
|
||||
/* split up y into y1+y2 and compute (y1+y2)*(t1+t2) */
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
*/
|
||||
|
||||
#ifndef lint
|
||||
static char rcsid[] = "$Id: e_powf.c,v 1.1 1994/08/10 20:31:17 jtc Exp $";
|
||||
static char rcsid[] = "$Id: e_powf.c,v 1.2 1994/08/18 23:05:54 jtc Exp $";
|
||||
#endif
|
||||
|
||||
#include "math.h"
|
||||
|
@ -66,8 +66,8 @@ ivln2_l = 7.0526075433e-06; /* 0x36eca570 =1/ln2 tail*/
|
|||
{
|
||||
float z,ax,z_h,z_l,p_h,p_l;
|
||||
float y1,t1,t2,r,s,t,u,v,w;
|
||||
int i,j,k,yisint,n;
|
||||
int hx,hy,ix,iy,is;
|
||||
int32_t i,j,k,yisint,n;
|
||||
int32_t hx,hy,ix,iy,is;
|
||||
|
||||
GET_FLOAT_WORD(hx,x);
|
||||
GET_FLOAT_WORD(hy,y);
|
||||
|
@ -129,7 +129,7 @@ ivln2_l = 7.0526075433e-06; /* 0x36eca570 =1/ln2 tail*/
|
|||
}
|
||||
|
||||
/* (x<0)**(non-int) is NaN */
|
||||
if(((((unsigned)hx>>31)-1)|yisint)==0) return (x-x)/(x-x);
|
||||
if(((((u_int32_t)hx>>31)-1)|yisint)==0) return (x-x)/(x-x);
|
||||
|
||||
/* |y| is huge */
|
||||
if(iy>0x4d000000) { /* if |y| > 2**27 */
|
||||
|
@ -200,7 +200,7 @@ ivln2_l = 7.0526075433e-06; /* 0x36eca570 =1/ln2 tail*/
|
|||
}
|
||||
|
||||
s = one; /* s (sign of result -ve**odd) = -1 else = 1 */
|
||||
if(((((unsigned)hx>>31)-1)|(yisint-1))==0)
|
||||
if(((((u_int32_t)hx>>31)-1)|(yisint-1))==0)
|
||||
s = -one; /* (-ve)**(odd int) */
|
||||
|
||||
/* split up y into y1+y2 and compute (y1+y2)*(t1+t2) */
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
*/
|
||||
|
||||
#ifndef lint
|
||||
static char rcsid[] = "$Id: e_rem_pio2.c,v 1.4 1994/08/10 20:31:21 jtc Exp $";
|
||||
static char rcsid[] = "$Id: e_rem_pio2.c,v 1.5 1994/08/18 23:05:56 jtc Exp $";
|
||||
#endif
|
||||
|
||||
/* __ieee754_rem_pio2(x,y)
|
||||
|
@ -27,9 +27,9 @@ static char rcsid[] = "$Id: e_rem_pio2.c,v 1.4 1994/08/10 20:31:21 jtc Exp $";
|
|||
* Table of constants for 2/pi, 396 Hex digits (476 decimal) of 2/pi
|
||||
*/
|
||||
#ifdef __STDC__
|
||||
static const int two_over_pi[] = {
|
||||
static const int32_t two_over_pi[] = {
|
||||
#else
|
||||
static int two_over_pi[] = {
|
||||
static int32_t two_over_pi[] = {
|
||||
#endif
|
||||
0xA2F983, 0x6E4E44, 0x1529FC, 0x2757D1, 0xF534DD, 0xC0DB62,
|
||||
0x95993C, 0x439041, 0xFE5163, 0xABDEBB, 0xC561B7, 0x246E3A,
|
||||
|
@ -45,9 +45,9 @@ static int two_over_pi[] = {
|
|||
};
|
||||
|
||||
#ifdef __STDC__
|
||||
static const int npio2_hw[] = {
|
||||
static const int32_t npio2_hw[] = {
|
||||
#else
|
||||
static int npio2_hw[] = {
|
||||
static int32_t npio2_hw[] = {
|
||||
#endif
|
||||
0x3FF921FB, 0x400921FB, 0x4012D97C, 0x401921FB, 0x401F6A7A, 0x4022D97C,
|
||||
0x4025FDBB, 0x402921FB, 0x402C463A, 0x402F6A7A, 0x4031475C, 0x4032D97C,
|
||||
|
@ -84,16 +84,16 @@ pio2_3 = 2.02226624871116645580e-21, /* 0x3BA3198A, 0x2E000000 */
|
|||
pio2_3t = 8.47842766036889956997e-32; /* 0x397B839A, 0x252049C1 */
|
||||
|
||||
#ifdef __STDC__
|
||||
int __ieee754_rem_pio2(double x, double *y)
|
||||
int32_t __ieee754_rem_pio2(double x, double *y)
|
||||
#else
|
||||
int __ieee754_rem_pio2(x,y)
|
||||
int32_t __ieee754_rem_pio2(x,y)
|
||||
double x,y[];
|
||||
#endif
|
||||
{
|
||||
double z,w,t,r,fn;
|
||||
double tx[3];
|
||||
int e0,i,j,nx,n,ix,hx;
|
||||
unsigned int low;
|
||||
int32_t e0,i,j,nx,n,ix,hx;
|
||||
u_int32_t low;
|
||||
|
||||
GET_HIGH_WORD(hx,x); /* high word of x */
|
||||
ix = hx&0x7fffffff;
|
||||
|
@ -101,14 +101,14 @@ pio2_3t = 8.47842766036889956997e-32; /* 0x397B839A, 0x252049C1 */
|
|||
{y[0] = x; y[1] = 0; return 0;}
|
||||
if(ix<=0x413921fb) { /* |x| ~<= 2^19*(pi/2), medium size */
|
||||
t = fabs(x);
|
||||
n = (int) (t*invpio2+half);
|
||||
n = (int32_t) (t*invpio2+half);
|
||||
fn = (double)n;
|
||||
r = t-fn*pio2_1;
|
||||
w = fn*pio2_1t; /* 1st round good to 85 bit */
|
||||
if(n<32&&ix!=npio2_hw[n-1]) {
|
||||
y[0] = r-w; /* quick check no cancellation */
|
||||
} else {
|
||||
unsigned int high;
|
||||
u_int32_t high;
|
||||
j = ix>>20;
|
||||
y[0] = r-w;
|
||||
GET_HIGH_WORD(high,y[0]);
|
||||
|
@ -144,9 +144,9 @@ pio2_3t = 8.47842766036889956997e-32; /* 0x397B839A, 0x252049C1 */
|
|||
GET_LOW_WORD(low,x);
|
||||
SET_LOW_WORD(z,low);
|
||||
e0 = (ix>>20)-1046; /* e0 = ilogb(z)-23; */
|
||||
SET_HIGH_WORD(z, ix - (e0<<20));
|
||||
SET_HIGH_WORD(z, ix - ((int32_t)(e0<<20)));
|
||||
for(i=0;i<2;i++) {
|
||||
tx[i] = (double)((int)(z));
|
||||
tx[i] = (double)((int32_t)(z));
|
||||
z = (z-tx[i])*two24;
|
||||
}
|
||||
tx[2] = z;
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
*/
|
||||
|
||||
#ifndef lint
|
||||
static char rcsid[] = "$Id: e_rem_pio2f.c,v 1.1 1994/08/10 20:31:22 jtc Exp $";
|
||||
static char rcsid[] = "$Id: e_rem_pio2f.c,v 1.2 1994/08/18 23:05:58 jtc Exp $";
|
||||
#endif
|
||||
|
||||
/* __ieee754_rem_pio2f(x,y)
|
||||
|
@ -30,9 +30,9 @@ static char rcsid[] = "$Id: e_rem_pio2f.c,v 1.1 1994/08/10 20:31:22 jtc Exp $";
|
|||
* Table of constants for 2/pi, 396 Hex digits (476 decimal) of 2/pi
|
||||
*/
|
||||
#ifdef __STDC__
|
||||
static const int two_over_pi[] = {
|
||||
static const int32_t two_over_pi[] = {
|
||||
#else
|
||||
static int two_over_pi[] = {
|
||||
static int32_t two_over_pi[] = {
|
||||
#endif
|
||||
0xA2, 0xF9, 0x83, 0x6E, 0x4E, 0x44, 0x15, 0x29, 0xFC,
|
||||
0x27, 0x57, 0xD1, 0xF5, 0x34, 0xDD, 0xC0, 0xDB, 0x62,
|
||||
|
@ -61,9 +61,9 @@ static int two_over_pi[] = {
|
|||
/* This array is like the one in e_rem_pio2.c, but the numbers are
|
||||
single precision and the last 8 bits are forced to 0. */
|
||||
#ifdef __STDC__
|
||||
static const int npio2_hw[] = {
|
||||
static const int32_t npio2_hw[] = {
|
||||
#else
|
||||
static int npio2_hw[] = {
|
||||
static int32_t npio2_hw[] = {
|
||||
#endif
|
||||
0x3fc90f00, 0x40490f00, 0x4096cb00, 0x40c90f00, 0x40fb5300, 0x4116cb00,
|
||||
0x412fed00, 0x41490f00, 0x41623100, 0x417b5300, 0x418a3a00, 0x4196cb00,
|
||||
|
@ -100,15 +100,15 @@ pio2_3 = 6.0770943833e-11, /* 0x2e85a300 */
|
|||
pio2_3t = 6.1232342629e-17; /* 0x248d3132 */
|
||||
|
||||
#ifdef __STDC__
|
||||
int __ieee754_rem_pio2f(float x, float *y)
|
||||
int32_t __ieee754_rem_pio2f(float x, float *y)
|
||||
#else
|
||||
int __ieee754_rem_pio2f(x,y)
|
||||
int32_t __ieee754_rem_pio2f(x,y)
|
||||
float x,y[];
|
||||
#endif
|
||||
{
|
||||
float z,w,t,r,fn;
|
||||
float tx[3];
|
||||
int e0,i,j,nx,n,ix,hx;
|
||||
int32_t e0,i,j,nx,n,ix,hx;
|
||||
|
||||
GET_FLOAT_WORD(hx,x);
|
||||
ix = hx&0x7fffffff;
|
||||
|
@ -116,14 +116,14 @@ pio2_3t = 6.1232342629e-17; /* 0x248d3132 */
|
|||
{y[0] = x; y[1] = 0; return 0;}
|
||||
if(ix<=0x43490f80) { /* |x| ~<= 2^7*(pi/2), medium size */
|
||||
t = fabsf(x);
|
||||
n = (int) (t*invpio2+half);
|
||||
n = (int32_t) (t*invpio2+half);
|
||||
fn = (float)n;
|
||||
r = t-fn*pio2_1;
|
||||
w = fn*pio2_1t; /* 1st round good to 40 bit */
|
||||
if(n<32&&(ix&0xffffff00)!=npio2_hw[n-1]) {
|
||||
y[0] = r-w; /* quick check no cancellation */
|
||||
} else {
|
||||
unsigned int high;
|
||||
u_int32_t high;
|
||||
j = ix>>23;
|
||||
y[0] = r-w;
|
||||
GET_FLOAT_WORD(high,y[0]);
|
||||
|
@ -157,9 +157,9 @@ pio2_3t = 6.1232342629e-17; /* 0x248d3132 */
|
|||
}
|
||||
/* set z = scalbn(|x|,ilogb(x)-7) */
|
||||
e0 = (ix>>23)-134; /* e0 = ilogb(z)-7; */
|
||||
SET_FLOAT_WORD(z, ix - (e0<<23));
|
||||
SET_FLOAT_WORD(z, ix - ((int32_t)(e0<<23)));
|
||||
for(i=0;i<2;i++) {
|
||||
tx[i] = (float)((int)(z));
|
||||
tx[i] = (float)((int32_t)(z));
|
||||
z = (z-tx[i])*two8;
|
||||
}
|
||||
tx[2] = z;
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
*/
|
||||
|
||||
#ifndef lint
|
||||
static char rcsid[] = "$Id: e_remainder.c,v 1.5 1994/08/10 20:31:24 jtc Exp $";
|
||||
static char rcsid[] = "$Id: e_remainder.c,v 1.6 1994/08/18 23:06:00 jtc Exp $";
|
||||
#endif
|
||||
|
||||
/* __ieee754_remainder(x,p)
|
||||
|
@ -40,8 +40,8 @@ static double zero = 0.0;
|
|||
double x,p;
|
||||
#endif
|
||||
{
|
||||
int hx,hp;
|
||||
unsigned sx,lx,lp;
|
||||
int32_t hx,hp;
|
||||
u_int32_t sx,lx,lp;
|
||||
double p_half;
|
||||
|
||||
EXTRACT_WORDS(hx,lx,x);
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
*/
|
||||
|
||||
#ifndef lint
|
||||
static char rcsid[] = "$Id: e_remainderf.c,v 1.1 1994/08/10 20:31:25 jtc Exp $";
|
||||
static char rcsid[] = "$Id: e_remainderf.c,v 1.2 1994/08/18 23:06:02 jtc Exp $";
|
||||
#endif
|
||||
|
||||
#include "math.h"
|
||||
|
@ -34,8 +34,8 @@ static float zero = 0.0;
|
|||
float x,p;
|
||||
#endif
|
||||
{
|
||||
int hx,hp;
|
||||
unsigned sx;
|
||||
int32_t hx,hp;
|
||||
u_int32_t sx;
|
||||
float p_half;
|
||||
|
||||
GET_FLOAT_WORD(hx,x);
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
*/
|
||||
|
||||
#ifndef lint
|
||||
static char rcsid[] = "$Id: e_sinh.c,v 1.4 1994/08/10 20:31:29 jtc Exp $";
|
||||
static char rcsid[] = "$Id: e_sinh.c,v 1.5 1994/08/18 23:06:03 jtc Exp $";
|
||||
#endif
|
||||
|
||||
/* __ieee754_sinh(x)
|
||||
|
@ -49,8 +49,8 @@ static double one = 1.0, shuge = 1.0e307;
|
|||
#endif
|
||||
{
|
||||
double t,w,h;
|
||||
int ix,jx;
|
||||
unsigned lx;
|
||||
int32_t ix,jx;
|
||||
u_int32_t lx;
|
||||
|
||||
/* High word of |x|. */
|
||||
GET_HIGH_WORD(jx,x);
|
||||
|
@ -75,7 +75,7 @@ static double one = 1.0, shuge = 1.0e307;
|
|||
|
||||
/* |x| in [log(maxdouble), overflowthresold] */
|
||||
GET_LOW_WORD(lx,x);
|
||||
if (ix<0x408633CE || (ix==0x408633ce)&&(lx<=(unsigned)0x8fb9f87d)) {
|
||||
if (ix<0x408633CE || (ix==0x408633ce)&&(lx<=(u_int32_t)0x8fb9f87d)) {
|
||||
w = __ieee754_exp(0.5*fabs(x));
|
||||
t = h*w;
|
||||
return t*w;
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
*/
|
||||
|
||||
#ifndef lint
|
||||
static char rcsid[] = "$Id: e_sinhf.c,v 1.1 1994/08/10 20:31:30 jtc Exp $";
|
||||
static char rcsid[] = "$Id: e_sinhf.c,v 1.2 1994/08/18 23:06:04 jtc Exp $";
|
||||
#endif
|
||||
|
||||
#include "math.h"
|
||||
|
@ -34,7 +34,7 @@ static float one = 1.0, shuge = 1.0e37;
|
|||
#endif
|
||||
{
|
||||
float t,w,h;
|
||||
int ix,jx;
|
||||
int32_t ix,jx;
|
||||
|
||||
GET_FLOAT_WORD(jx,x);
|
||||
ix = jx&0x7fffffff;
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
*/
|
||||
|
||||
#ifndef lint
|
||||
static char rcsid[] = "$Id: e_sqrt.c,v 1.5 1994/08/10 20:31:31 jtc Exp $";
|
||||
static char rcsid[] = "$Id: e_sqrt.c,v 1.6 1994/08/18 23:06:06 jtc Exp $";
|
||||
#endif
|
||||
|
||||
/* __ieee754_sqrt(x)
|
||||
|
@ -101,9 +101,9 @@ static double one = 1.0, tiny=1.0e-300;
|
|||
#endif
|
||||
{
|
||||
double z;
|
||||
int sign = (int)0x80000000;
|
||||
unsigned r,t1,s1,ix1,q1;
|
||||
int ix0,s0,q,m,t,i;
|
||||
int32_t sign = (int)0x80000000;
|
||||
int32_t ix0,s0,q,m,t,i;
|
||||
u_int32_t r,t1,s1,ix1,q1;
|
||||
|
||||
EXTRACT_WORDS(ix0,ix1,x);
|
||||
|
||||
|
@ -178,9 +178,9 @@ static double one = 1.0, tiny=1.0e-300;
|
|||
z = one-tiny; /* trigger inexact flag */
|
||||
if (z>=one) {
|
||||
z = one+tiny;
|
||||
if (q1==(unsigned)0xffffffff) { q1=0; q += 1;}
|
||||
if (q1==(u_int32_t)0xffffffff) { q1=0; q += 1;}
|
||||
else if (z>one) {
|
||||
if (q1==(unsigned)0xfffffffe) q+=1;
|
||||
if (q1==(u_int32_t)0xfffffffe) q+=1;
|
||||
q1+=2;
|
||||
} else
|
||||
q1 += (q1&1);
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
*/
|
||||
|
||||
#ifndef lint
|
||||
static char rcsid[] = "$Id: e_sqrtf.c,v 1.1 1994/08/10 20:31:33 jtc Exp $";
|
||||
static char rcsid[] = "$Id: e_sqrtf.c,v 1.2 1994/08/18 23:06:07 jtc Exp $";
|
||||
#endif
|
||||
|
||||
#include "math.h"
|
||||
|
@ -34,9 +34,9 @@ static float one = 1.0, tiny=1.0e-30;
|
|||
#endif
|
||||
{
|
||||
float z;
|
||||
int sign = (int)0x80000000;
|
||||
unsigned r;
|
||||
int ix,s,q,m,t,i;
|
||||
int32_t sign = (int)0x80000000;
|
||||
int32_t ix,s,q,m,t,i;
|
||||
u_int32_t r;
|
||||
|
||||
GET_FLOAT_WORD(ix,x);
|
||||
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
*/
|
||||
|
||||
#ifndef lint
|
||||
static char rcsid[] = "$Id: k_cos.c,v 1.5 1994/08/10 20:31:34 jtc Exp $";
|
||||
static char rcsid[] = "$Id: k_cos.c,v 1.6 1994/08/18 23:06:08 jtc Exp $";
|
||||
#endif
|
||||
|
||||
/*
|
||||
|
@ -73,7 +73,7 @@ C6 = -1.13596475577881948265e-11; /* 0xBDA8FAE9, 0xBE8838D4 */
|
|||
#endif
|
||||
{
|
||||
double a,hz,z,r,qx;
|
||||
int ix;
|
||||
int32_t ix;
|
||||
GET_HIGH_WORD(ix,x);
|
||||
ix &= 0x7fffffff; /* ix = |x|'s high word*/
|
||||
if(ix<0x3e400000) { /* if x < 2**27 */
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
*/
|
||||
|
||||
#ifndef lint
|
||||
static char rcsid[] = "$Id: k_cosf.c,v 1.1 1994/08/10 20:31:36 jtc Exp $";
|
||||
static char rcsid[] = "$Id: k_cosf.c,v 1.2 1994/08/18 23:06:10 jtc Exp $";
|
||||
#endif
|
||||
|
||||
#include "math.h"
|
||||
|
@ -41,7 +41,7 @@ C6 = -1.1359647598e-11; /* 0xad47d74e */
|
|||
#endif
|
||||
{
|
||||
float a,hz,z,r,qx;
|
||||
int ix;
|
||||
int32_t ix;
|
||||
GET_FLOAT_WORD(ix,x);
|
||||
ix &= 0x7fffffff; /* ix = |x|'s high word*/
|
||||
if(ix<0x32000000) { /* if x < 2**27 */
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
*/
|
||||
|
||||
#ifndef lint
|
||||
static char rcsid[] = "$Id: k_rem_pio2.c,v 1.4 1994/08/10 20:31:38 jtc Exp $";
|
||||
static char rcsid[] = "$Id: k_rem_pio2.c,v 1.5 1994/08/18 23:06:11 jtc Exp $";
|
||||
#endif
|
||||
|
||||
/*
|
||||
|
@ -165,13 +165,13 @@ two24 = 1.67772160000000000000e+07, /* 0x41700000, 0x00000000 */
|
|||
twon24 = 5.96046447753906250000e-08; /* 0x3E700000, 0x00000000 */
|
||||
|
||||
#ifdef __STDC__
|
||||
int __kernel_rem_pio2(double *x, double *y, int e0, int nx, int prec, const int *ipio2)
|
||||
int __kernel_rem_pio2(double *x, double *y, int e0, int nx, int prec, const int32_t *ipio2)
|
||||
#else
|
||||
int __kernel_rem_pio2(x,y,e0,nx,prec,ipio2)
|
||||
double x[], y[]; int e0,nx,prec; int ipio2[];
|
||||
double x[], y[]; int e0,nx,prec; int32_t ipio2[];
|
||||
#endif
|
||||
{
|
||||
int jz,jx,jv,jp,jk,carry,n,iq[20],i,j,k,m,q0,ih;
|
||||
int32_t jz,jx,jv,jp,jk,carry,n,iq[20],i,j,k,m,q0,ih;
|
||||
double z,fw,f[20],fq[20],q[20];
|
||||
|
||||
/* initialize jk*/
|
||||
|
@ -196,15 +196,15 @@ twon24 = 5.96046447753906250000e-08; /* 0x3E700000, 0x00000000 */
|
|||
recompute:
|
||||
/* distill q[] into iq[] reversingly */
|
||||
for(i=0,j=jz,z=q[jz];j>0;i++,j--) {
|
||||
fw = (double)((int)(twon24* z));
|
||||
iq[i] = (int)(z-two24*fw);
|
||||
fw = (double)((int32_t)(twon24* z));
|
||||
iq[i] = (int32_t)(z-two24*fw);
|
||||
z = q[j-1]+fw;
|
||||
}
|
||||
|
||||
/* compute n */
|
||||
z = scalbn(z,q0); /* actual value of z */
|
||||
z -= 8.0*floor(z*0.125); /* trim off integer >= 8 */
|
||||
n = (int) z;
|
||||
n = (int32_t) z;
|
||||
z -= (double)n;
|
||||
ih = 0;
|
||||
if(q0>0) { /* need iq[jz-1] to determine n */
|
||||
|
@ -263,11 +263,11 @@ recompute:
|
|||
} else { /* break z into 24-bit if necessary */
|
||||
z = scalbn(z,-q0);
|
||||
if(z>=two24) {
|
||||
fw = (double)((int)(twon24*z));
|
||||
iq[jz] = (int)(z-two24*fw);
|
||||
fw = (double)((int32_t)(twon24*z));
|
||||
iq[jz] = (int32_t)(z-two24*fw);
|
||||
jz += 1; q0 += 24;
|
||||
iq[jz] = (int) fw;
|
||||
} else iq[jz] = (int) z ;
|
||||
iq[jz] = (int32_t) fw;
|
||||
} else iq[jz] = (int32_t) z ;
|
||||
}
|
||||
|
||||
/* convert integer "bit" chunk to floating-point value */
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
*/
|
||||
|
||||
#ifndef lint
|
||||
static char rcsid[] = "$Id: k_rem_pio2f.c,v 1.1 1994/08/10 20:31:39 jtc Exp $";
|
||||
static char rcsid[] = "$Id: k_rem_pio2f.c,v 1.2 1994/08/18 23:06:12 jtc Exp $";
|
||||
#endif
|
||||
|
||||
#include "math.h"
|
||||
|
@ -58,13 +58,13 @@ two8 = 2.5600000000e+02, /* 0x43800000 */
|
|||
twon8 = 3.9062500000e-03; /* 0x3b800000 */
|
||||
|
||||
#ifdef __STDC__
|
||||
int __kernel_rem_pio2f(float *x, float *y, int e0, int nx, int prec, const int *ipio2)
|
||||
int __kernel_rem_pio2f(float *x, float *y, int e0, int nx, int prec, const int32_t *ipio2)
|
||||
#else
|
||||
int __kernel_rem_pio2f(x,y,e0,nx,prec,ipio2)
|
||||
float x[], y[]; int e0,nx,prec; int ipio2[];
|
||||
float x[], y[]; int e0,nx,prec; int32_t ipio2[];
|
||||
#endif
|
||||
{
|
||||
int jz,jx,jv,jp,jk,carry,n,iq[20],i,j,k,m,q0,ih;
|
||||
int32_t jz,jx,jv,jp,jk,carry,n,iq[20],i,j,k,m,q0,ih;
|
||||
float z,fw,f[20],fq[20],q[20];
|
||||
|
||||
/* initialize jk*/
|
||||
|
@ -89,15 +89,15 @@ twon8 = 3.9062500000e-03; /* 0x3b800000 */
|
|||
recompute:
|
||||
/* distill q[] into iq[] reversingly */
|
||||
for(i=0,j=jz,z=q[jz];j>0;i++,j--) {
|
||||
fw = (float)((int)(twon8* z));
|
||||
iq[i] = (int)(z-two8*fw);
|
||||
fw = (float)((int32_t)(twon8* z));
|
||||
iq[i] = (int32_t)(z-two8*fw);
|
||||
z = q[j-1]+fw;
|
||||
}
|
||||
|
||||
/* compute n */
|
||||
z = scalbnf(z,q0); /* actual value of z */
|
||||
z -= (float)8.0*floorf(z*(float)0.125); /* trim off integer >= 8 */
|
||||
n = (int) z;
|
||||
n = (int32_t) z;
|
||||
z -= (float)n;
|
||||
ih = 0;
|
||||
if(q0>0) { /* need iq[jz-1] to determine n */
|
||||
|
@ -156,11 +156,11 @@ recompute:
|
|||
} else { /* break z into 8-bit if necessary */
|
||||
z = scalbnf(z,-q0);
|
||||
if(z>=two8) {
|
||||
fw = (float)((int)(twon8*z));
|
||||
iq[jz] = (int)(z-two8*fw);
|
||||
fw = (float)((int32_t)(twon8*z));
|
||||
iq[jz] = (int32_t)(z-two8*fw);
|
||||
jz += 1; q0 += 8;
|
||||
iq[jz] = (int) fw;
|
||||
} else iq[jz] = (int) z ;
|
||||
iq[jz] = (int32_t) fw;
|
||||
} else iq[jz] = (int32_t) z ;
|
||||
}
|
||||
|
||||
/* convert integer "bit" chunk to floating-point value */
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
*/
|
||||
|
||||
#ifndef lint
|
||||
static char rcsid[] = "$Id: k_sin.c,v 1.5 1994/08/10 20:31:41 jtc Exp $";
|
||||
static char rcsid[] = "$Id: k_sin.c,v 1.6 1994/08/18 23:06:14 jtc Exp $";
|
||||
#endif
|
||||
|
||||
/* __kernel_sin( x, y, iy)
|
||||
|
@ -66,7 +66,7 @@ S6 = 1.58969099521155010221e-10; /* 0x3DE5D93A, 0x5ACFD57C */
|
|||
#endif
|
||||
{
|
||||
double z,r,v;
|
||||
int ix;
|
||||
int32_t ix;
|
||||
GET_HIGH_WORD(ix,x);
|
||||
ix &= 0x7fffffff; /* high word of x */
|
||||
if(ix<0x3e400000) /* |x| < 2**-27 */
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
*/
|
||||
|
||||
#ifndef lint
|
||||
static char rcsid[] = "$Id: k_sinf.c,v 1.1 1994/08/10 20:31:43 jtc Exp $";
|
||||
static char rcsid[] = "$Id: k_sinf.c,v 1.2 1994/08/18 23:06:15 jtc Exp $";
|
||||
#endif
|
||||
|
||||
#include "math.h"
|
||||
|
@ -41,7 +41,7 @@ S6 = 1.5896910177e-10; /* 0x2f2ec9d3 */
|
|||
#endif
|
||||
{
|
||||
float z,r,v;
|
||||
int ix;
|
||||
int32_t ix;
|
||||
GET_FLOAT_WORD(ix,x);
|
||||
ix &= 0x7fffffff; /* high word of x */
|
||||
if(ix<0x32000000) /* |x| < 2**-27 */
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
*/
|
||||
|
||||
#ifndef lint
|
||||
static char rcsid[] = "$Id: k_tan.c,v 1.5 1994/08/10 20:31:46 jtc Exp $";
|
||||
static char rcsid[] = "$Id: k_tan.c,v 1.6 1994/08/18 23:06:16 jtc Exp $";
|
||||
#endif
|
||||
|
||||
/* __kernel_tan( x, y, k )
|
||||
|
@ -82,12 +82,12 @@ T[] = {
|
|||
#endif
|
||||
{
|
||||
double z,r,v,w,s;
|
||||
int ix,hx;
|
||||
int32_t ix,hx;
|
||||
GET_HIGH_WORD(hx,x);
|
||||
ix = hx&0x7fffffff; /* high word of |x| */
|
||||
if(ix<0x3e300000) /* x < 2**-28 */
|
||||
{if((int)x==0) { /* generate inexact */
|
||||
unsigned int low;
|
||||
u_int32_t low;
|
||||
GET_LOW_WORD(low,x);
|
||||
if(((ix|low)|(iy+1))==0) return one/fabs(x);
|
||||
else return (iy==1)? x: -one/x;
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
*/
|
||||
|
||||
#ifndef lint
|
||||
static char rcsid[] = "$Id: k_tanf.c,v 1.1 1994/08/10 20:31:48 jtc Exp $";
|
||||
static char rcsid[] = "$Id: k_tanf.c,v 1.2 1994/08/18 23:06:18 jtc Exp $";
|
||||
#endif
|
||||
|
||||
#include "math.h"
|
||||
|
@ -51,7 +51,7 @@ T[] = {
|
|||
#endif
|
||||
{
|
||||
float z,r,v,w,s;
|
||||
int ix,hx;
|
||||
int32_t ix,hx;
|
||||
GET_FLOAT_WORD(hx,x);
|
||||
ix = hx&0x7fffffff; /* high word of |x| */
|
||||
if(ix<0x31800000) /* x < 2**-28 */
|
||||
|
@ -87,7 +87,7 @@ T[] = {
|
|||
simply return -1.0/(x+r) here */
|
||||
/* compute -1.0/(x+r) accurately */
|
||||
float a,t;
|
||||
int i;
|
||||
int32_t i;
|
||||
z = w;
|
||||
GET_FLOAT_WORD(i,z);
|
||||
SET_FLOAT_WORD(z,i&0xfffff000);
|
||||
|
|
|
@ -11,13 +11,14 @@
|
|||
|
||||
/*
|
||||
* from: @(#)fdlibm.h 5.1 93/09/24
|
||||
* $Id: math_private.h,v 1.1 1994/08/10 20:31:51 jtc Exp $
|
||||
* $Id: math_private.h,v 1.2 1994/08/18 23:06:19 jtc Exp $
|
||||
*/
|
||||
|
||||
#ifndef _MATH_PRIVATE_H_
|
||||
#define _MATH_PRIVATE_H_
|
||||
|
||||
#include <machine/endian.h>
|
||||
#include <sys/types.h>
|
||||
|
||||
/* The original fdlibm code used statements like:
|
||||
n0 = ((*(int*)&one)>>29)^1; * index of high word *
|
||||
|
@ -40,9 +41,8 @@ typedef union
|
|||
double value;
|
||||
struct
|
||||
{
|
||||
/* FIXME: Assumes 32 bit int. */
|
||||
unsigned int msw;
|
||||
unsigned int lsw;
|
||||
u_int32_t msw;
|
||||
u_int32_t lsw;
|
||||
} parts;
|
||||
} ieee_double_shape_type;
|
||||
|
||||
|
@ -55,9 +55,8 @@ typedef union
|
|||
double value;
|
||||
struct
|
||||
{
|
||||
/* FIXME: Assumes 32 bit int. */
|
||||
unsigned int lsw;
|
||||
unsigned int msw;
|
||||
u_int32_t lsw;
|
||||
u_int32_t msw;
|
||||
} parts;
|
||||
} ieee_double_shape_type;
|
||||
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
*/
|
||||
|
||||
#ifndef lint
|
||||
static char rcsid[] = "$Id: s_asinh.c,v 1.5 1994/08/10 20:31:53 jtc Exp $";
|
||||
static char rcsid[] = "$Id: s_asinh.c,v 1.6 1994/08/18 23:06:20 jtc Exp $";
|
||||
#endif
|
||||
|
||||
/* asinh(x)
|
||||
|
@ -45,7 +45,7 @@ huge= 1.00000000000000000000e+300;
|
|||
#endif
|
||||
{
|
||||
double t,w;
|
||||
int hx,ix;
|
||||
int32_t hx,ix;
|
||||
GET_HIGH_WORD(hx,x);
|
||||
ix = hx&0x7fffffff;
|
||||
if(ix>=0x7ff00000) return x+x; /* x is inf or NaN */
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
*/
|
||||
|
||||
#ifndef lint
|
||||
static char rcsid[] = "$Id: s_asinhf.c,v 1.1 1994/08/10 20:31:54 jtc Exp $";
|
||||
static char rcsid[] = "$Id: s_asinhf.c,v 1.2 1994/08/18 23:06:21 jtc Exp $";
|
||||
#endif
|
||||
|
||||
#include "math.h"
|
||||
|
@ -37,7 +37,7 @@ huge= 1.0000000000e+30;
|
|||
#endif
|
||||
{
|
||||
float t,w;
|
||||
int hx,ix;
|
||||
int32_t hx,ix;
|
||||
GET_FLOAT_WORD(hx,x);
|
||||
ix = hx&0x7fffffff;
|
||||
if(ix>=0x7f800000) return x+x; /* x is inf or NaN */
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
*/
|
||||
|
||||
#ifndef lint
|
||||
static char rcsid[] = "$Id: s_atan.c,v 1.5 1994/08/10 20:31:55 jtc Exp $";
|
||||
static char rcsid[] = "$Id: s_atan.c,v 1.6 1994/08/18 23:06:23 jtc Exp $";
|
||||
#endif
|
||||
|
||||
/* atan(x)
|
||||
|
@ -93,12 +93,12 @@ huge = 1.0e300;
|
|||
#endif
|
||||
{
|
||||
double w,s1,s2,z;
|
||||
int ix,hx,id;
|
||||
int32_t ix,hx,id;
|
||||
|
||||
GET_HIGH_WORD(hx,x);
|
||||
ix = hx&0x7fffffff;
|
||||
if(ix>=0x44100000) { /* if |x| >= 2^66 */
|
||||
unsigned int low;
|
||||
u_int32_t low;
|
||||
GET_LOW_WORD(low,x);
|
||||
if(ix>0x7ff00000||
|
||||
(ix==0x7ff00000&&(low!=0)))
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
*/
|
||||
|
||||
#ifndef lint
|
||||
static char rcsid[] = "$Id: s_atanf.c,v 1.1 1994/08/10 20:31:56 jtc Exp $";
|
||||
static char rcsid[] = "$Id: s_atanf.c,v 1.2 1994/08/18 23:06:24 jtc Exp $";
|
||||
#endif
|
||||
|
||||
#include "math.h"
|
||||
|
@ -76,7 +76,7 @@ huge = 1.0e30;
|
|||
#endif
|
||||
{
|
||||
float w,s1,s2,z;
|
||||
int ix,hx,id;
|
||||
int32_t ix,hx,id;
|
||||
|
||||
GET_FLOAT_WORD(hx,x);
|
||||
ix = hx&0x7fffffff;
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
*/
|
||||
|
||||
#ifndef lint
|
||||
static char rcsid[] = "$Id: s_cbrt.c,v 1.5 1994/08/10 20:31:59 jtc Exp $";
|
||||
static char rcsid[] = "$Id: s_cbrt.c,v 1.6 1994/08/18 23:06:25 jtc Exp $";
|
||||
#endif
|
||||
|
||||
#include "math.h"
|
||||
|
@ -21,9 +21,9 @@ static char rcsid[] = "$Id: s_cbrt.c,v 1.5 1994/08/10 20:31:59 jtc Exp $";
|
|||
* Return cube root of x
|
||||
*/
|
||||
#ifdef __STDC__
|
||||
static const unsigned
|
||||
static const u_int32_t
|
||||
#else
|
||||
static unsigned
|
||||
static u_int32_t
|
||||
#endif
|
||||
B1 = 715094163, /* B1 = (682-0.03306235651)*2**20 */
|
||||
B2 = 696219795; /* B2 = (664-0.03306235651)*2**20 */
|
||||
|
@ -46,10 +46,10 @@ G = 3.57142857142857150787e-01; /* 5/14 = 0x3FD6DB6D, 0xB6DB6DB7 */
|
|||
double x;
|
||||
#endif
|
||||
{
|
||||
int hx;
|
||||
int32_t hx;
|
||||
double r,s,t=0.0,w;
|
||||
unsigned sign;
|
||||
unsigned int high,low;
|
||||
u_int32_t sign;
|
||||
u_int32_t high,low;
|
||||
|
||||
GET_HIGH_WORD(hx,x);
|
||||
sign=hx&0x80000000; /* sign= sign(x) */
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
*/
|
||||
|
||||
#ifndef lint
|
||||
static char rcsid[] = "$Id: s_cbrtf.c,v 1.1 1994/08/10 20:32:01 jtc Exp $";
|
||||
static char rcsid[] = "$Id: s_cbrtf.c,v 1.2 1994/08/18 23:06:27 jtc Exp $";
|
||||
#endif
|
||||
|
||||
#include "math.h"
|
||||
|
@ -49,10 +49,10 @@ G = 3.5714286566e-01; /* 5/14 = 0x3eb6db6e */
|
|||
float x;
|
||||
#endif
|
||||
{
|
||||
int hx;
|
||||
float r,s,t;
|
||||
unsigned sign;
|
||||
unsigned int high;
|
||||
int32_t hx;
|
||||
u_int32_t sign;
|
||||
u_int32_t high;
|
||||
|
||||
GET_FLOAT_WORD(hx,x);
|
||||
sign=hx&0x80000000; /* sign= sign(x) */
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
*/
|
||||
|
||||
#ifndef lint
|
||||
static char rcsid[] = "$Id: s_ceil.c,v 1.5 1994/08/10 20:32:03 jtc Exp $";
|
||||
static char rcsid[] = "$Id: s_ceil.c,v 1.6 1994/08/18 23:06:29 jtc Exp $";
|
||||
#endif
|
||||
|
||||
/*
|
||||
|
@ -39,8 +39,8 @@ static double huge = 1.0e300;
|
|||
double x;
|
||||
#endif
|
||||
{
|
||||
int i0,i1,j0;
|
||||
unsigned i,j;
|
||||
int32_t i0,i1,j0;
|
||||
u_int32_t i,j;
|
||||
EXTRACT_WORDS(i0,i1,x);
|
||||
j0 = ((i0>>20)&0x7ff)-0x3ff;
|
||||
if(j0<20) {
|
||||
|
@ -61,7 +61,7 @@ static double huge = 1.0e300;
|
|||
if(j0==0x400) return x+x; /* inf or NaN */
|
||||
else return x; /* x is integral */
|
||||
} else {
|
||||
i = ((unsigned)(0xffffffff))>>(j0-20);
|
||||
i = ((u_int32_t)(0xffffffff))>>(j0-20);
|
||||
if((i1&i)==0) return x; /* x is integral */
|
||||
if(huge+x>0.0) { /* raise inexact flag */
|
||||
if(i0>0) {
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
*/
|
||||
|
||||
#ifndef lint
|
||||
static char rcsid[] = "$Id: s_ceilf.c,v 1.1 1994/08/10 20:32:04 jtc Exp $";
|
||||
static char rcsid[] = "$Id: s_ceilf.c,v 1.2 1994/08/18 23:06:30 jtc Exp $";
|
||||
#endif
|
||||
|
||||
#include "math.h"
|
||||
|
@ -33,8 +33,9 @@ static float huge = 1.0e30;
|
|||
float x;
|
||||
#endif
|
||||
{
|
||||
int i0,j0;
|
||||
unsigned i;
|
||||
int32_t i0,j0;
|
||||
u_int32_t i;
|
||||
|
||||
GET_FLOAT_WORD(i0,x);
|
||||
j0 = ((i0>>23)&0xff)-0x7f;
|
||||
if(j0<23) {
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
*/
|
||||
|
||||
#ifndef lint
|
||||
static char rcsid[] = "$Id: s_copysign.c,v 1.5 1994/08/10 20:32:06 jtc Exp $";
|
||||
static char rcsid[] = "$Id: s_copysign.c,v 1.6 1994/08/18 23:06:31 jtc Exp $";
|
||||
#endif
|
||||
|
||||
/*
|
||||
|
@ -30,7 +30,7 @@ static char rcsid[] = "$Id: s_copysign.c,v 1.5 1994/08/10 20:32:06 jtc Exp $";
|
|||
double x,y;
|
||||
#endif
|
||||
{
|
||||
unsigned int hx,hy;
|
||||
u_int32_t hx,hy;
|
||||
GET_HIGH_WORD(hx,x);
|
||||
GET_HIGH_WORD(hy,y);
|
||||
SET_HIGH_WORD(x,(hx&0x7fffffff)|(hy&0x80000000));
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
*/
|
||||
|
||||
#ifndef lint
|
||||
static char rcsid[] = "$Id: s_copysignf.c,v 1.1 1994/08/10 20:32:07 jtc Exp $";
|
||||
static char rcsid[] = "$Id: s_copysignf.c,v 1.2 1994/08/18 23:06:33 jtc Exp $";
|
||||
#endif
|
||||
|
||||
/*
|
||||
|
@ -33,7 +33,7 @@ static char rcsid[] = "$Id: s_copysignf.c,v 1.1 1994/08/10 20:32:07 jtc Exp $";
|
|||
float x,y;
|
||||
#endif
|
||||
{
|
||||
unsigned int ix,iy;
|
||||
u_int32_t ix,iy;
|
||||
GET_FLOAT_WORD(ix,x);
|
||||
GET_FLOAT_WORD(iy,y);
|
||||
SET_FLOAT_WORD(x,(ix&0x7fffffff)|(iy&0x80000000));
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
*/
|
||||
|
||||
#ifndef lint
|
||||
static char rcsid[] = "$Id: s_cos.c,v 1.4 1994/08/10 20:32:08 jtc Exp $";
|
||||
static char rcsid[] = "$Id: s_cos.c,v 1.5 1994/08/18 23:06:34 jtc Exp $";
|
||||
#endif
|
||||
|
||||
/* cos(x)
|
||||
|
@ -56,7 +56,7 @@ static char rcsid[] = "$Id: s_cos.c,v 1.4 1994/08/10 20:32:08 jtc Exp $";
|
|||
#endif
|
||||
{
|
||||
double y[2],z=0.0;
|
||||
int n, ix;
|
||||
int32_t n, ix;
|
||||
|
||||
/* High word of x. */
|
||||
GET_HIGH_WORD(ix,x);
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
*/
|
||||
|
||||
#ifndef lint
|
||||
static char rcsid[] = "$Id: s_cosf.c,v 1.1 1994/08/10 20:32:10 jtc Exp $";
|
||||
static char rcsid[] = "$Id: s_cosf.c,v 1.2 1994/08/18 23:06:35 jtc Exp $";
|
||||
#endif
|
||||
|
||||
#include "math.h"
|
||||
|
@ -34,7 +34,7 @@ static float one=1.0;
|
|||
#endif
|
||||
{
|
||||
float y[2],z=0.0;
|
||||
int n, ix;
|
||||
int32_t n,ix;
|
||||
|
||||
GET_FLOAT_WORD(ix,x);
|
||||
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
*/
|
||||
|
||||
#ifndef lint
|
||||
static char rcsid[] = "$Id: s_erf.c,v 1.5 1994/08/10 20:32:11 jtc Exp $";
|
||||
static char rcsid[] = "$Id: s_erf.c,v 1.6 1994/08/18 23:06:36 jtc Exp $";
|
||||
#endif
|
||||
|
||||
/* double erf(double x)
|
||||
|
@ -198,12 +198,12 @@ sb7 = -2.24409524465858183362e+01; /* 0xC03670E2, 0x42712D62 */
|
|||
double x;
|
||||
#endif
|
||||
{
|
||||
int hx,ix,i;
|
||||
int32_t hx,ix,i;
|
||||
double R,S,P,Q,s,y,z,r;
|
||||
GET_HIGH_WORD(hx,x);
|
||||
ix = hx&0x7fffffff;
|
||||
if(ix>=0x7ff00000) { /* erf(nan)=nan */
|
||||
i = ((unsigned)hx>>31)<<1;
|
||||
i = ((u_int32_t)hx>>31)<<1;
|
||||
return (double)(1-i)+one/x; /* erf(+-inf)=+-1 */
|
||||
}
|
||||
|
||||
|
@ -254,13 +254,13 @@ sb7 = -2.24409524465858183362e+01; /* 0xC03670E2, 0x42712D62 */
|
|||
double x;
|
||||
#endif
|
||||
{
|
||||
int hx,ix;
|
||||
int32_t hx,ix;
|
||||
double R,S,P,Q,s,y,z,r;
|
||||
GET_HIGH_WORD(hx,x);
|
||||
ix = hx&0x7fffffff;
|
||||
if(ix>=0x7ff00000) { /* erfc(nan)=nan */
|
||||
/* erfc(+-inf)=0,2 */
|
||||
return (double)(((unsigned)hx>>31)<<1)+one/x;
|
||||
return (double)(((u_int32_t)hx>>31)<<1)+one/x;
|
||||
}
|
||||
|
||||
if(ix < 0x3feb0000) { /* |x|<0.84375 */
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
*/
|
||||
|
||||
#ifndef lint
|
||||
static char rcsid[] = "$Id: s_erff.c,v 1.1 1994/08/10 20:32:13 jtc Exp $";
|
||||
static char rcsid[] = "$Id: s_erff.c,v 1.2 1994/08/18 23:06:38 jtc Exp $";
|
||||
#endif
|
||||
|
||||
#include "math.h"
|
||||
|
@ -106,12 +106,12 @@ sb7 = -2.2440952301e+01; /* 0xc1b38712 */
|
|||
float x;
|
||||
#endif
|
||||
{
|
||||
int hx,ix,i;
|
||||
int32_t hx,ix,i;
|
||||
float R,S,P,Q,s,y,z,r;
|
||||
GET_FLOAT_WORD(hx,x);
|
||||
ix = hx&0x7fffffff;
|
||||
if(ix>=0x7f800000) { /* erf(nan)=nan */
|
||||
i = ((unsigned)hx>>31)<<1;
|
||||
i = ((u_int32_t)hx>>31)<<1;
|
||||
return (float)(1-i)+one/x; /* erf(+-inf)=+-1 */
|
||||
}
|
||||
|
||||
|
@ -163,13 +163,13 @@ sb7 = -2.2440952301e+01; /* 0xc1b38712 */
|
|||
float x;
|
||||
#endif
|
||||
{
|
||||
int hx,ix;
|
||||
int32_t hx,ix;
|
||||
float R,S,P,Q,s,y,z,r;
|
||||
GET_FLOAT_WORD(hx,x);
|
||||
ix = hx&0x7fffffff;
|
||||
if(ix>=0x7f800000) { /* erfc(nan)=nan */
|
||||
/* erfc(+-inf)=0,2 */
|
||||
return (float)(((unsigned)hx>>31)<<1)+one/x;
|
||||
return (float)(((u_int32_t)hx>>31)<<1)+one/x;
|
||||
}
|
||||
|
||||
if(ix < 0x3f580000) { /* |x|<0.84375 */
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
*/
|
||||
|
||||
#ifndef lint
|
||||
static char rcsid[] = "$Id: s_expm1.c,v 1.5 1994/08/10 20:32:15 jtc Exp $";
|
||||
static char rcsid[] = "$Id: s_expm1.c,v 1.6 1994/08/18 23:06:39 jtc Exp $";
|
||||
#endif
|
||||
|
||||
/* expm1(x)
|
||||
|
@ -139,8 +139,8 @@ Q5 = -2.01099218183624371326e-07; /* BE8AFDB7 6E09C32D */
|
|||
#endif
|
||||
{
|
||||
double y,hi,lo,c,t,e,hxs,hfx,r1;
|
||||
int k,xsb;
|
||||
unsigned hx;
|
||||
int32_t k,xsb;
|
||||
u_int32_t hx;
|
||||
|
||||
GET_HIGH_WORD(hx,x);
|
||||
xsb = hx&0x80000000; /* sign bit of x */
|
||||
|
@ -151,7 +151,7 @@ Q5 = -2.01099218183624371326e-07; /* BE8AFDB7 6E09C32D */
|
|||
if(hx >= 0x4043687A) { /* if |x|>=56*ln2 */
|
||||
if(hx >= 0x40862E42) { /* if |x|>=709.78... */
|
||||
if(hx>=0x7ff00000) {
|
||||
unsigned int low;
|
||||
u_int32_t low;
|
||||
GET_LOW_WORD(low,x);
|
||||
if(((hx&0xfffff)|low)!=0)
|
||||
return x+x; /* NaN */
|
||||
|
@ -202,7 +202,7 @@ Q5 = -2.01099218183624371326e-07; /* BE8AFDB7 6E09C32D */
|
|||
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;
|
||||
u_int32_t high;
|
||||
y = one-(e-x);
|
||||
GET_HIGH_WORD(high,y);
|
||||
SET_HIGH_WORD(y,high+(k<<20)); /* add k to y's exponent */
|
||||
|
@ -210,13 +210,13 @@ Q5 = -2.01099218183624371326e-07; /* BE8AFDB7 6E09C32D */
|
|||
}
|
||||
t = one;
|
||||
if(k<20) {
|
||||
unsigned int high;
|
||||
u_int32_t high;
|
||||
SET_HIGH_WORD(t,0x3ff00000 - (0x200000>>k)); /* t=1-2^-k */
|
||||
y = t-(e-x);
|
||||
GET_HIGH_WORD(high,y);
|
||||
SET_HIGH_WORD(y,high+(k<<20)); /* add k to y's exponent */
|
||||
} else {
|
||||
unsigned int high;
|
||||
u_int32_t high;
|
||||
SET_HIGH_WORD(t,((0x3ff-k)<<20)); /* 2^-k */
|
||||
y = x-(e+t);
|
||||
y += one;
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
*/
|
||||
|
||||
#ifndef lint
|
||||
static char rcsid[] = "$Id: s_expm1f.c,v 1.1 1994/08/10 20:32:16 jtc Exp $";
|
||||
static char rcsid[] = "$Id: s_expm1f.c,v 1.2 1994/08/18 23:06:40 jtc Exp $";
|
||||
#endif
|
||||
|
||||
#include "math.h"
|
||||
|
@ -47,8 +47,8 @@ Q5 = -2.0109921195e-07; /* 0xb457edbb */
|
|||
#endif
|
||||
{
|
||||
float y,hi,lo,c,t,e,hxs,hfx,r1;
|
||||
int k,xsb;
|
||||
unsigned hx;
|
||||
int32_t k,xsb;
|
||||
u_int32_t hx;
|
||||
|
||||
GET_FLOAT_WORD(hx,x);
|
||||
xsb = hx&0x80000000; /* sign bit of x */
|
||||
|
@ -107,7 +107,7 @@ Q5 = -2.0109921195e-07; /* 0xb457edbb */
|
|||
if(x < (float)-0.25) return -(float)2.0*(e-(x+(float)0.5));
|
||||
else return one+(float)2.0*(x-e);
|
||||
if (k <= -2 || k>56) { /* suffice to return exp(x)-1 */
|
||||
int i;
|
||||
int32_t i;
|
||||
y = one-(e-x);
|
||||
GET_FLOAT_WORD(i,y);
|
||||
SET_FLOAT_WORD(y,i+(k<<23)); /* add k to y's exponent */
|
||||
|
@ -115,13 +115,13 @@ Q5 = -2.0109921195e-07; /* 0xb457edbb */
|
|||
}
|
||||
t = one;
|
||||
if(k<23) {
|
||||
int i;
|
||||
int32_t i;
|
||||
SET_FLOAT_WORD(t,0x3f800000 - (0x1000000>>k)); /* t=1-2^-k */
|
||||
y = t-(e-x);
|
||||
GET_FLOAT_WORD(i,y);
|
||||
SET_FLOAT_WORD(y,i+(k<<23)); /* add k to y's exponent */
|
||||
} else {
|
||||
int i;
|
||||
int32_t i;
|
||||
SET_FLOAT_WORD(t,((0x7f-k)<<23)); /* 2^-k */
|
||||
y = x-(e+t);
|
||||
y += one;
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
*/
|
||||
|
||||
#ifndef lint
|
||||
static char rcsid[] = "$Id: s_fabs.c,v 1.4 1994/08/10 20:32:17 jtc Exp $";
|
||||
static char rcsid[] = "$Id: s_fabs.c,v 1.5 1994/08/18 23:06:42 jtc Exp $";
|
||||
#endif
|
||||
|
||||
/*
|
||||
|
@ -28,7 +28,7 @@ static char rcsid[] = "$Id: s_fabs.c,v 1.4 1994/08/10 20:32:17 jtc Exp $";
|
|||
double x;
|
||||
#endif
|
||||
{
|
||||
unsigned int high;
|
||||
u_int32_t high;
|
||||
GET_HIGH_WORD(high,x);
|
||||
SET_HIGH_WORD(x,high&0x7fffffff);
|
||||
return x;
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
*/
|
||||
|
||||
#ifndef lint
|
||||
static char rcsid[] = "$Id: s_fabsf.c,v 1.1 1994/08/10 20:32:19 jtc Exp $";
|
||||
static char rcsid[] = "$Id: s_fabsf.c,v 1.2 1994/08/18 23:06:43 jtc Exp $";
|
||||
#endif
|
||||
|
||||
/*
|
||||
|
@ -31,7 +31,7 @@ static char rcsid[] = "$Id: s_fabsf.c,v 1.1 1994/08/10 20:32:19 jtc Exp $";
|
|||
float x;
|
||||
#endif
|
||||
{
|
||||
unsigned int ix;
|
||||
u_int32_t ix;
|
||||
GET_FLOAT_WORD(ix,x);
|
||||
SET_FLOAT_WORD(x,ix&0x7fffffff);
|
||||
return x;
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
*/
|
||||
|
||||
#ifndef lint
|
||||
static char rcsid[] = "$Id: s_finite.c,v 1.5 1994/08/10 20:32:21 jtc Exp $";
|
||||
static char rcsid[] = "$Id: s_finite.c,v 1.6 1994/08/18 23:06:44 jtc Exp $";
|
||||
#endif
|
||||
|
||||
/*
|
||||
|
@ -29,7 +29,7 @@ static char rcsid[] = "$Id: s_finite.c,v 1.5 1994/08/10 20:32:21 jtc Exp $";
|
|||
double x;
|
||||
#endif
|
||||
{
|
||||
int hx;
|
||||
int32_t hx;
|
||||
GET_HIGH_WORD(hx,x);
|
||||
return (unsigned)((hx&0x7fffffff)-0x7ff00000)>>31;
|
||||
return (int)((u_int32_t)((hx&0x7fffffff)-0x7ff00000)>>31);
|
||||
}
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
*/
|
||||
|
||||
#ifndef lint
|
||||
static char rcsid[] = "$Id: s_finitef.c,v 1.1 1994/08/10 20:32:23 jtc Exp $";
|
||||
static char rcsid[] = "$Id: s_finitef.c,v 1.2 1994/08/18 23:06:45 jtc Exp $";
|
||||
#endif
|
||||
|
||||
/*
|
||||
|
@ -32,7 +32,7 @@ static char rcsid[] = "$Id: s_finitef.c,v 1.1 1994/08/10 20:32:23 jtc Exp $";
|
|||
float x;
|
||||
#endif
|
||||
{
|
||||
int ix;
|
||||
int32_t ix;
|
||||
GET_FLOAT_WORD(ix,x);
|
||||
return (unsigned)((ix&0x7fffffff)-0x7f800000)>>31;
|
||||
return (int)((u_int32_t)((ix&0x7fffffff)-0x7f800000)>>31);
|
||||
}
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
*/
|
||||
|
||||
#ifndef lint
|
||||
static char rcsid[] = "$Id: s_floor.c,v 1.5 1994/08/10 20:32:25 jtc Exp $";
|
||||
static char rcsid[] = "$Id: s_floor.c,v 1.6 1994/08/18 23:06:47 jtc Exp $";
|
||||
#endif
|
||||
|
||||
/*
|
||||
|
@ -39,8 +39,8 @@ static double huge = 1.0e300;
|
|||
double x;
|
||||
#endif
|
||||
{
|
||||
int i0,i1,j0;
|
||||
unsigned i,j;
|
||||
int32_t i0,i1,j0;
|
||||
u_int32_t i,j;
|
||||
EXTRACT_WORDS(i0,i1,x);
|
||||
j0 = ((i0>>20)&0x7ff)-0x3ff;
|
||||
if(j0<20) {
|
||||
|
@ -62,7 +62,7 @@ static double huge = 1.0e300;
|
|||
if(j0==0x400) return x+x; /* inf or NaN */
|
||||
else return x; /* x is integral */
|
||||
} else {
|
||||
i = ((unsigned)(0xffffffff))>>(j0-20);
|
||||
i = ((u_int32_t)(0xffffffff))>>(j0-20);
|
||||
if((i1&i)==0) return x; /* x is integral */
|
||||
if(huge+x>0.0) { /* raise inexact flag */
|
||||
if(i0<0) {
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
*/
|
||||
|
||||
#ifndef lint
|
||||
static char rcsid[] = "$Id: s_floorf.c,v 1.1 1994/08/10 20:32:26 jtc Exp $";
|
||||
static char rcsid[] = "$Id: s_floorf.c,v 1.2 1994/08/18 23:06:48 jtc Exp $";
|
||||
#endif
|
||||
|
||||
/*
|
||||
|
@ -42,8 +42,8 @@ static float huge = 1.0e30;
|
|||
float x;
|
||||
#endif
|
||||
{
|
||||
int i0,j0;
|
||||
unsigned i;
|
||||
int32_t i0,j0;
|
||||
u_int32_t i;
|
||||
GET_FLOAT_WORD(i0,x);
|
||||
j0 = ((i0>>23)&0xff)-0x7f;
|
||||
if(j0<23) {
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
*/
|
||||
|
||||
#ifndef lint
|
||||
static char rcsid[] = "$Id: s_frexp.c,v 1.5 1994/08/10 20:32:28 jtc Exp $";
|
||||
static char rcsid[] = "$Id: s_frexp.c,v 1.6 1994/08/18 23:06:49 jtc Exp $";
|
||||
#endif
|
||||
|
||||
/*
|
||||
|
@ -42,7 +42,7 @@ two54 = 1.80143985094819840000e+16; /* 0x43500000, 0x00000000 */
|
|||
double x; int *eptr;
|
||||
#endif
|
||||
{
|
||||
int hx, ix, lx;
|
||||
int32_t hx, ix, lx;
|
||||
EXTRACT_WORDS(hx,lx,x);
|
||||
ix = 0x7fffffff&hx;
|
||||
*eptr = 0;
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
*/
|
||||
|
||||
#ifndef lint
|
||||
static char rcsid[] = "$Id: s_frexpf.c,v 1.1 1994/08/10 20:32:29 jtc Exp $";
|
||||
static char rcsid[] = "$Id: s_frexpf.c,v 1.2 1994/08/18 23:06:51 jtc Exp $";
|
||||
#endif
|
||||
|
||||
#include "math.h"
|
||||
|
@ -35,7 +35,7 @@ two25 = 3.3554432000e+07; /* 0x4c000000 */
|
|||
float x; int *eptr;
|
||||
#endif
|
||||
{
|
||||
int hx, ix;
|
||||
int32_t hx,ix;
|
||||
GET_FLOAT_WORD(hx,x);
|
||||
ix = 0x7fffffff&hx;
|
||||
*eptr = 0;
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
*/
|
||||
|
||||
#ifndef lint
|
||||
static char rcsid[] = "$Id: s_ilogb.c,v 1.5 1994/08/10 20:32:31 jtc Exp $";
|
||||
static char rcsid[] = "$Id: s_ilogb.c,v 1.6 1994/08/18 23:06:52 jtc Exp $";
|
||||
#endif
|
||||
|
||||
/* ilogb(double x)
|
||||
|
@ -30,7 +30,7 @@ static char rcsid[] = "$Id: s_ilogb.c,v 1.5 1994/08/10 20:32:31 jtc Exp $";
|
|||
double x;
|
||||
#endif
|
||||
{
|
||||
int hx,lx,ix;
|
||||
int32_t hx,lx,ix;
|
||||
|
||||
EXTRACT_WORDS(hx,lx,x);
|
||||
hx &= 0x7fffffff;
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
*/
|
||||
|
||||
#ifndef lint
|
||||
static char rcsid[] = "$Id: s_ilogbf.c,v 1.1 1994/08/10 20:32:33 jtc Exp $";
|
||||
static char rcsid[] = "$Id: s_ilogbf.c,v 1.2 1994/08/18 23:06:53 jtc Exp $";
|
||||
#endif
|
||||
|
||||
#include "math.h"
|
||||
|
@ -27,7 +27,7 @@ static char rcsid[] = "$Id: s_ilogbf.c,v 1.1 1994/08/10 20:32:33 jtc Exp $";
|
|||
float x;
|
||||
#endif
|
||||
{
|
||||
int hx,ix;
|
||||
int32_t hx,ix;
|
||||
|
||||
GET_FLOAT_WORD(hx,x);
|
||||
hx &= 0x7fffffff;
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
*/
|
||||
|
||||
#ifndef lint
|
||||
static char rcsid[] = "$Id: s_isnan.c,v 1.5 1994/08/10 20:32:34 jtc Exp $";
|
||||
static char rcsid[] = "$Id: s_isnan.c,v 1.6 1994/08/18 23:06:54 jtc Exp $";
|
||||
#endif
|
||||
|
||||
/*
|
||||
|
@ -29,10 +29,10 @@ static char rcsid[] = "$Id: s_isnan.c,v 1.5 1994/08/10 20:32:34 jtc Exp $";
|
|||
double x;
|
||||
#endif
|
||||
{
|
||||
int hx,lx;
|
||||
int32_t hx,lx;
|
||||
EXTRACT_WORDS(hx,lx,x);
|
||||
hx &= 0x7fffffff;
|
||||
hx |= (unsigned)(lx|(-lx))>>31;
|
||||
hx |= (u_int32_t)(lx|(-lx))>>31;
|
||||
hx = 0x7ff00000 - hx;
|
||||
return ((unsigned)(hx))>>31;
|
||||
return (int)((u_int32_t)(hx))>>31;
|
||||
}
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
*/
|
||||
|
||||
#ifndef lint
|
||||
static char rcsid[] = "$Id: s_isnanf.c,v 1.1 1994/08/10 20:32:36 jtc Exp $";
|
||||
static char rcsid[] = "$Id: s_isnanf.c,v 1.2 1994/08/18 23:06:56 jtc Exp $";
|
||||
#endif
|
||||
|
||||
/*
|
||||
|
@ -32,9 +32,9 @@ static char rcsid[] = "$Id: s_isnanf.c,v 1.1 1994/08/10 20:32:36 jtc Exp $";
|
|||
float x;
|
||||
#endif
|
||||
{
|
||||
int ix;
|
||||
int32_t ix;
|
||||
GET_FLOAT_WORD(ix,x);
|
||||
ix &= 0x7fffffff;
|
||||
ix = 0x7f800000 - ix;
|
||||
return ((unsigned)(ix))>>31;
|
||||
return (int)(((u_int32_t)(ix))>>31);
|
||||
}
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
*/
|
||||
|
||||
#ifndef lint
|
||||
static char rcsid[] = "$Id: s_log1p.c,v 1.5 1994/08/10 20:32:41 jtc Exp $";
|
||||
static char rcsid[] = "$Id: s_log1p.c,v 1.6 1994/08/18 23:06:59 jtc Exp $";
|
||||
#endif
|
||||
|
||||
/* double log1p(double x)
|
||||
|
@ -112,7 +112,7 @@ static double zero = 0.0;
|
|||
#endif
|
||||
{
|
||||
double hfsq,f,c,s,z,R,u;
|
||||
int k,hx,hu,ax;
|
||||
int32_t k,hx,hu,ax;
|
||||
|
||||
GET_HIGH_WORD(hx,x);
|
||||
ax = hx&0x7fffffff;
|
||||
|
@ -130,7 +130,7 @@ static double zero = 0.0;
|
|||
else
|
||||
return x - x*x*0.5;
|
||||
}
|
||||
if(hx>0||hx<=((int)0xbfd2bec3)) {
|
||||
if(hx>0||hx<=((int32_t)0xbfd2bec3)) {
|
||||
k=0;f=x;hu=1;} /* -0.2929<x<0.41422 */
|
||||
}
|
||||
if (hx >= 0x7ff00000) return x+x;
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
*/
|
||||
|
||||
#ifndef lint
|
||||
static char rcsid[] = "$Id: s_log1pf.c,v 1.1 1994/08/10 20:32:44 jtc Exp $";
|
||||
static char rcsid[] = "$Id: s_log1pf.c,v 1.2 1994/08/18 23:07:02 jtc Exp $";
|
||||
#endif
|
||||
|
||||
#include "math.h"
|
||||
|
@ -50,7 +50,7 @@ static float zero = 0.0;
|
|||
#endif
|
||||
{
|
||||
float hfsq,f,c,s,z,R,u;
|
||||
int k,hx,hu,ax;
|
||||
int32_t k,hx,hu,ax;
|
||||
|
||||
GET_FLOAT_WORD(hx,x);
|
||||
ax = hx&0x7fffffff;
|
||||
|
@ -68,7 +68,7 @@ static float zero = 0.0;
|
|||
else
|
||||
return x - x*x*(float)0.5;
|
||||
}
|
||||
if(hx>0||hx<=((int)0xbe95f61f)) {
|
||||
if(hx>0||hx<=((int32_t)0xbe95f61f)) {
|
||||
k=0;f=x;hu=1;} /* -0.2929<x<0.41422 */
|
||||
}
|
||||
if (hx >= 0x7f800000) return x+x;
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
*/
|
||||
|
||||
#ifndef lint
|
||||
static char rcsid[] = "$Id: s_logb.c,v 1.5 1994/08/10 20:32:47 jtc Exp $";
|
||||
static char rcsid[] = "$Id: s_logb.c,v 1.6 1994/08/18 23:07:04 jtc Exp $";
|
||||
#endif
|
||||
|
||||
/*
|
||||
|
@ -30,7 +30,7 @@ static char rcsid[] = "$Id: s_logb.c,v 1.5 1994/08/10 20:32:47 jtc Exp $";
|
|||
double x;
|
||||
#endif
|
||||
{
|
||||
int lx,ix;
|
||||
int32_t lx,ix;
|
||||
EXTRACT_WORDS(ix,lx,x);
|
||||
ix &= 0x7fffffff; /* high |x| */
|
||||
if((ix|lx)==0) return -1.0/fabs(x);
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
*/
|
||||
|
||||
#ifndef lint
|
||||
static char rcsid[] = "$Id: s_logbf.c,v 1.1 1994/08/10 20:32:49 jtc Exp $";
|
||||
static char rcsid[] = "$Id: s_logbf.c,v 1.2 1994/08/18 23:07:07 jtc Exp $";
|
||||
#endif
|
||||
|
||||
#include "math.h"
|
||||
|
@ -27,7 +27,7 @@ static char rcsid[] = "$Id: s_logbf.c,v 1.1 1994/08/10 20:32:49 jtc Exp $";
|
|||
float x;
|
||||
#endif
|
||||
{
|
||||
int ix;
|
||||
int32_t ix;
|
||||
GET_FLOAT_WORD(ix,x);
|
||||
ix &= 0x7fffffff; /* high |x| */
|
||||
if(ix==0) return (float)-1.0/fabsf(x);
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
*/
|
||||
|
||||
#ifndef lint
|
||||
static char rcsid[] = "$Id: s_modf.c,v 1.5 1994/08/10 20:32:53 jtc Exp $";
|
||||
static char rcsid[] = "$Id: s_modf.c,v 1.6 1994/08/18 23:07:09 jtc Exp $";
|
||||
#endif
|
||||
|
||||
/*
|
||||
|
@ -40,8 +40,8 @@ static double one = 1.0;
|
|||
double x,*iptr;
|
||||
#endif
|
||||
{
|
||||
int i0,i1,j0;
|
||||
unsigned i;
|
||||
int32_t i0,i1,j0;
|
||||
u_int32_t i;
|
||||
EXTRACT_WORDS(i0,i1,x);
|
||||
j0 = ((i0>>20)&0x7ff)-0x3ff; /* exponent of x */
|
||||
if(j0<20) { /* integer part in high x */
|
||||
|
@ -51,7 +51,7 @@ static double one = 1.0;
|
|||
} else {
|
||||
i = (0x000fffff)>>j0;
|
||||
if(((i0&i)|i1)==0) { /* x is integral */
|
||||
unsigned int high;
|
||||
u_int32_t high;
|
||||
*iptr = x;
|
||||
GET_HIGH_WORD(high,x);
|
||||
INSERT_WORDS(x,high&0x80000000,0); /* return +-0 */
|
||||
|
@ -62,15 +62,15 @@ static double one = 1.0;
|
|||
}
|
||||
}
|
||||
} else if (j0>51) { /* no fraction part */
|
||||
unsigned int high;
|
||||
u_int32_t high;
|
||||
*iptr = x*one;
|
||||
GET_HIGH_WORD(high,x);
|
||||
INSERT_WORDS(x,high&0x80000000,0); /* return +-0 */
|
||||
return x;
|
||||
} else { /* fraction part in low x */
|
||||
i = ((unsigned)(0xffffffff))>>(j0-20);
|
||||
i = ((u_int32_t)(0xffffffff))>>(j0-20);
|
||||
if((i1&i)==0) { /* x is integral */
|
||||
unsigned int high;
|
||||
u_int32_t high;
|
||||
*iptr = x;
|
||||
GET_HIGH_WORD(high,x);
|
||||
INSERT_WORDS(x,high&0x80000000,0); /* return +-0 */
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
*/
|
||||
|
||||
#ifndef lint
|
||||
static char rcsid[] = "$Id: s_modff.c,v 1.1 1994/08/10 20:32:55 jtc Exp $";
|
||||
static char rcsid[] = "$Id: s_modff.c,v 1.2 1994/08/18 23:07:12 jtc Exp $";
|
||||
#endif
|
||||
|
||||
#include "math.h"
|
||||
|
@ -33,8 +33,8 @@ static float one = 1.0;
|
|||
float x,*iptr;
|
||||
#endif
|
||||
{
|
||||
int i0,j0;
|
||||
unsigned i;
|
||||
int32_t i0,j0;
|
||||
u_int32_t i;
|
||||
GET_FLOAT_WORD(i0,x);
|
||||
j0 = ((i0>>23)&0xff)-0x7f; /* exponent of x */
|
||||
if(j0<23) { /* integer part in x */
|
||||
|
@ -44,7 +44,7 @@ static float one = 1.0;
|
|||
} else {
|
||||
i = (0x007fffff)>>j0;
|
||||
if((i0&i)==0) { /* x is integral */
|
||||
unsigned int ix;
|
||||
u_int32_t ix;
|
||||
*iptr = x;
|
||||
GET_FLOAT_WORD(ix,x);
|
||||
SET_FLOAT_WORD(x,ix&0x80000000); /* return +-0 */
|
||||
|
@ -55,7 +55,7 @@ static float one = 1.0;
|
|||
}
|
||||
}
|
||||
} else { /* no fraction part */
|
||||
unsigned int ix;
|
||||
u_int32_t ix;
|
||||
*iptr = x*one;
|
||||
GET_FLOAT_WORD(ix,x);
|
||||
SET_FLOAT_WORD(x,ix&0x80000000); /* return +-0 */
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
*/
|
||||
|
||||
#ifndef lint
|
||||
static char rcsid[] = "$Id: s_nextafter.c,v 1.5 1994/08/10 20:32:57 jtc Exp $";
|
||||
static char rcsid[] = "$Id: s_nextafter.c,v 1.6 1994/08/18 23:07:13 jtc Exp $";
|
||||
#endif
|
||||
|
||||
/* IEEE functions
|
||||
|
@ -31,8 +31,8 @@ static char rcsid[] = "$Id: s_nextafter.c,v 1.5 1994/08/10 20:32:57 jtc Exp $";
|
|||
double x,y;
|
||||
#endif
|
||||
{
|
||||
int hx,hy,ix,iy;
|
||||
unsigned lx,ly;
|
||||
int32_t hx,hy,ix,iy;
|
||||
u_int32_t lx,ly;
|
||||
|
||||
EXTRACT_WORDS(hx,lx,x);
|
||||
EXTRACT_WORDS(hy,ly,y);
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
*/
|
||||
|
||||
#ifndef lint
|
||||
static char rcsid[] = "$Id: s_nextafterf.c,v 1.1 1994/08/10 20:32:58 jtc Exp $";
|
||||
static char rcsid[] = "$Id: s_nextafterf.c,v 1.2 1994/08/18 23:07:15 jtc Exp $";
|
||||
#endif
|
||||
|
||||
#include "math.h"
|
||||
|
@ -27,7 +27,7 @@ static char rcsid[] = "$Id: s_nextafterf.c,v 1.1 1994/08/10 20:32:58 jtc Exp $";
|
|||
float x,y;
|
||||
#endif
|
||||
{
|
||||
int hx,hy,ix,iy;
|
||||
int32_t hx,hy,ix,iy;
|
||||
|
||||
GET_FLOAT_WORD(hx,x);
|
||||
GET_FLOAT_WORD(hy,y);
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
*/
|
||||
|
||||
#ifndef lint
|
||||
static char rcsid[] = "$Id: s_rint.c,v 1.5 1994/08/10 20:32:59 jtc Exp $";
|
||||
static char rcsid[] = "$Id: s_rint.c,v 1.6 1994/08/18 23:07:16 jtc Exp $";
|
||||
#endif
|
||||
|
||||
/*
|
||||
|
@ -44,8 +44,8 @@ TWO52[2]={
|
|||
double x;
|
||||
#endif
|
||||
{
|
||||
int i0,j0,sx;
|
||||
unsigned i,i1;
|
||||
int32_t i0,j0,sx;
|
||||
u_int32_t i,i1;
|
||||
double w,t;
|
||||
EXTRACT_WORDS(i0,i1,x);
|
||||
sx = (i0>>31)&1;
|
||||
|
@ -75,7 +75,7 @@ TWO52[2]={
|
|||
if(j0==0x400) return x+x; /* inf or NaN */
|
||||
else return x; /* x is integral */
|
||||
} else {
|
||||
i = ((unsigned)(0xffffffff))>>(j0-20);
|
||||
i = ((u_int32_t)(0xffffffff))>>(j0-20);
|
||||
if((i1&i)==0) return x; /* x is integral */
|
||||
i>>=1;
|
||||
if((i1&i)!=0) i1 = (i1&(~i))|((0x40000000)>>(j0-20));
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
*/
|
||||
|
||||
#ifndef lint
|
||||
static char rcsid[] = "$Id: s_rintf.c,v 1.1 1994/08/10 20:33:01 jtc Exp $";
|
||||
static char rcsid[] = "$Id: s_rintf.c,v 1.2 1994/08/18 23:07:17 jtc Exp $";
|
||||
#endif
|
||||
|
||||
#include "math.h"
|
||||
|
@ -37,8 +37,8 @@ TWO23[2]={
|
|||
float x;
|
||||
#endif
|
||||
{
|
||||
int i0,j0,sx;
|
||||
unsigned i,i1;
|
||||
int32_t i0,j0,sx;
|
||||
u_int32_t i,i1;
|
||||
float w,t;
|
||||
GET_FLOAT_WORD(i0,x);
|
||||
sx = (i0>>31)&1;
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
*/
|
||||
|
||||
#ifndef lint
|
||||
static char rcsid[] = "$Id: s_scalbn.c,v 1.5 1994/08/10 20:33:02 jtc Exp $";
|
||||
static char rcsid[] = "$Id: s_scalbn.c,v 1.6 1994/08/18 23:10:13 jtc Exp $";
|
||||
#endif
|
||||
|
||||
/*
|
||||
|
@ -41,7 +41,7 @@ tiny = 1.0e-300;
|
|||
double x; int n;
|
||||
#endif
|
||||
{
|
||||
int k,hx,lx;
|
||||
int32_t k,hx,lx;
|
||||
EXTRACT_WORDS(hx,lx,x);
|
||||
k = (hx&0x7ff00000)>>20; /* extract exponent */
|
||||
if (k==0) { /* 0 or subnormal x */
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
*/
|
||||
|
||||
#ifndef lint
|
||||
static char rcsid[] = "$Id: s_scalbnf.c,v 1.1 1994/08/10 20:33:03 jtc Exp $";
|
||||
static char rcsid[] = "$Id: s_scalbnf.c,v 1.2 1994/08/18 23:10:15 jtc Exp $";
|
||||
#endif
|
||||
|
||||
#include "math.h"
|
||||
|
@ -37,7 +37,7 @@ tiny = 1.0e-30;
|
|||
float x; int n;
|
||||
#endif
|
||||
{
|
||||
int k,ix;
|
||||
int32_t k,ix;
|
||||
GET_FLOAT_WORD(ix,x);
|
||||
k = (ix&0x7f800000)>>23; /* extract exponent */
|
||||
if (k==0) { /* 0 or subnormal x */
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
*/
|
||||
|
||||
#ifndef lint
|
||||
static char rcsid[] = "$Id: s_sin.c,v 1.4 1994/08/10 20:33:09 jtc Exp $";
|
||||
static char rcsid[] = "$Id: s_sin.c,v 1.5 1994/08/18 23:10:17 jtc Exp $";
|
||||
#endif
|
||||
|
||||
/* sin(x)
|
||||
|
@ -56,7 +56,7 @@ static char rcsid[] = "$Id: s_sin.c,v 1.4 1994/08/10 20:33:09 jtc Exp $";
|
|||
#endif
|
||||
{
|
||||
double y[2],z=0.0;
|
||||
int n, ix;
|
||||
int32_t n, ix;
|
||||
|
||||
/* High word of x. */
|
||||
GET_HIGH_WORD(ix,x);
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
*/
|
||||
|
||||
#ifndef lint
|
||||
static char rcsid[] = "$Id: s_sinf.c,v 1.1 1994/08/10 20:33:10 jtc Exp $";
|
||||
static char rcsid[] = "$Id: s_sinf.c,v 1.2 1994/08/18 23:10:18 jtc Exp $";
|
||||
#endif
|
||||
|
||||
#include "math.h"
|
||||
|
@ -28,7 +28,7 @@ static char rcsid[] = "$Id: s_sinf.c,v 1.1 1994/08/10 20:33:10 jtc Exp $";
|
|||
#endif
|
||||
{
|
||||
float y[2],z=0.0;
|
||||
int n, ix;
|
||||
int32_t n, ix;
|
||||
|
||||
GET_FLOAT_WORD(ix,x);
|
||||
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
*/
|
||||
|
||||
#ifndef lint
|
||||
static char rcsid[] = "$Id: s_tan.c,v 1.4 1994/08/10 20:33:12 jtc Exp $";
|
||||
static char rcsid[] = "$Id: s_tan.c,v 1.5 1994/08/18 23:10:19 jtc Exp $";
|
||||
#endif
|
||||
|
||||
/* tan(x)
|
||||
|
@ -55,7 +55,7 @@ static char rcsid[] = "$Id: s_tan.c,v 1.4 1994/08/10 20:33:12 jtc Exp $";
|
|||
#endif
|
||||
{
|
||||
double y[2],z=0.0;
|
||||
int n, ix;
|
||||
int32_t n, ix;
|
||||
|
||||
/* High word of x. */
|
||||
GET_HIGH_WORD(ix,x);
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
*/
|
||||
|
||||
#ifndef lint
|
||||
static char rcsid[] = "$Id: s_tanf.c,v 1.1 1994/08/10 20:33:13 jtc Exp $";
|
||||
static char rcsid[] = "$Id: s_tanf.c,v 1.2 1994/08/18 23:10:20 jtc Exp $";
|
||||
#endif
|
||||
|
||||
#include "math.h"
|
||||
|
@ -28,7 +28,7 @@ static char rcsid[] = "$Id: s_tanf.c,v 1.1 1994/08/10 20:33:13 jtc Exp $";
|
|||
#endif
|
||||
{
|
||||
float y[2],z=0.0;
|
||||
int n, ix;
|
||||
int32_t n, ix;
|
||||
|
||||
GET_FLOAT_WORD(ix,x);
|
||||
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
*/
|
||||
|
||||
#ifndef lint
|
||||
static char rcsid[] = "$Id: s_tanh.c,v 1.4 1994/08/10 20:33:15 jtc Exp $";
|
||||
static char rcsid[] = "$Id: s_tanh.c,v 1.5 1994/08/18 23:10:22 jtc Exp $";
|
||||
#endif
|
||||
|
||||
/* Tanh(x)
|
||||
|
@ -55,7 +55,7 @@ static double one=1.0, two=2.0, tiny = 1.0e-300;
|
|||
#endif
|
||||
{
|
||||
double t,z;
|
||||
int jx,ix;
|
||||
int32_t jx,ix;
|
||||
|
||||
/* High word of |x|. */
|
||||
GET_HIGH_WORD(jx,x);
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
*/
|
||||
|
||||
#ifndef lint
|
||||
static char rcsid[] = "$Id: s_tanhf.c,v 1.1 1994/08/10 20:33:16 jtc Exp $";
|
||||
static char rcsid[] = "$Id: s_tanhf.c,v 1.2 1994/08/18 23:10:23 jtc Exp $";
|
||||
#endif
|
||||
|
||||
#include "math.h"
|
||||
|
@ -34,7 +34,7 @@ static float one=1.0, two=2.0, tiny = 1.0e-30;
|
|||
#endif
|
||||
{
|
||||
float t,z;
|
||||
int jx,ix;
|
||||
int32_t jx,ix;
|
||||
|
||||
GET_FLOAT_WORD(jx,x);
|
||||
ix = jx&0x7fffffff;
|
||||
|
|
Loading…
Reference in New Issue