Submitted by: J.T. Conklin <jtc@wimsey.com>

Second part of update to fdlibm 5.2: speed up argument reduction for trig
functions in the case pi/4 < |x| < 3pi/4.

Remove unused static constants ("one").
This commit is contained in:
bde 1995-04-07 23:23:27 +00:00
parent 9b4502240a
commit 37e8274742
6 changed files with 56 additions and 10 deletions

View File

@ -11,7 +11,7 @@
*/
#ifndef lint
static char rcsid[] = "$Id: e_log10.c,v 1.6 1994/08/18 23:05:44 jtc Exp $";
static char rcsid[] = "$Id: e_log10.c,v 1.1.1.1 1994/08/19 09:39:44 jkh Exp $";
#endif
/* __ieee754_log10(x)
@ -55,7 +55,6 @@ static const double
#else
static double
#endif
one = 1.0,
two54 = 1.80143985094819840000e+16, /* 0x43500000, 0x00000000 */
ivln10 = 4.34294481903251816668e-01, /* 0x3FDBCB7B, 0x1526E50E */
log10_2hi = 3.01029995663611771306e-01, /* 0x3FD34413, 0x509F6000 */

View File

@ -14,7 +14,7 @@
*/
#ifndef lint
static char rcsid[] = "$Id: e_log10f.c,v 1.2 1994/08/18 23:05:46 jtc Exp $";
static char rcsid[] = "$Id: e_log10f.c,v 1.1.1.1 1994/08/19 09:39:56 jkh Exp $";
#endif
#include "math.h"
@ -25,7 +25,6 @@ static const float
#else
static float
#endif
one = 1.0,
two25 = 3.3554432000e+07, /* 0x4c000000 */
ivln10 = 4.3429449201e-01, /* 0x3ede5bd9 */
log10_2hi = 3.0102920532e-01, /* 0x3e9a2080 */

View File

@ -11,7 +11,7 @@
*/
#ifndef lint
static char rcsid[] = "$Id: e_rem_pio2.c,v 1.5 1994/08/18 23:05:56 jtc Exp $";
static char rcsid[] = "$Id: e_rem_pio2.c,v 1.1.1.1 1994/08/19 09:39:44 jkh Exp $";
#endif
/* __ieee754_rem_pio2(x,y)
@ -99,6 +99,31 @@ pio2_3t = 8.47842766036889956997e-32; /* 0x397B839A, 0x252049C1 */
ix = hx&0x7fffffff;
if(ix<=0x3fe921fb) /* |x| ~<= pi/4 , no need for reduction */
{y[0] = x; y[1] = 0; return 0;}
if(ix<0x4002d97c) { /* |x| < 3pi/4, special case with n=+-1 */
if(hx>0) {
z = x - pio2_1;
if(ix!=0x3ff921fb) { /* 33+53 bit pi is good enough */
y[0] = z - pio2_1t;
y[1] = (z-y[0])-pio2_1t;
} else { /* near pi/2, use 33+33+53 bit pi */
z -= pio2_2;
y[0] = z - pio2_2t;
y[1] = (z-y[0])-pio2_2t;
}
return 1;
} else { /* negative x */
z = x + pio2_1;
if(ix!=0x3ff921fb) { /* 33+53 bit pi is good enough */
y[0] = z + pio2_1t;
y[1] = (z-y[0])+pio2_1t;
} else { /* near pi/2, use 33+33+53 bit pi */
z += pio2_2;
y[0] = z + pio2_2t;
y[1] = (z-y[0])+pio2_2t;
}
return -1;
}
}
if(ix<=0x413921fb) { /* |x| ~<= 2^19*(pi/2), medium size */
t = fabs(x);
n = (int32_t) (t*invpio2+half);

View File

@ -14,7 +14,7 @@
*/
#ifndef lint
static char rcsid[] = "$Id: e_rem_pio2f.c,v 1.2 1994/08/18 23:05:58 jtc Exp $";
static char rcsid[] = "$Id: e_rem_pio2f.c,v 1.1.1.1 1994/08/19 09:39:57 jkh Exp $";
#endif
/* __ieee754_rem_pio2f(x,y)
@ -114,6 +114,31 @@ pio2_3t = 6.1232342629e-17; /* 0x248d3132 */
ix = hx&0x7fffffff;
if(ix<=0x3f490fd8) /* |x| ~<= pi/4 , no need for reduction */
{y[0] = x; y[1] = 0; return 0;}
if(ix<0x4016cbe4) { /* |x| < 3pi/4, special case with n=+-1 */
if(hx>0) {
z = x - pio2_1;
if((ix&0xfffffff0)!=0x3fc90fd0) { /* 24+24 bit pi OK */
y[0] = z - pio2_1t;
y[1] = (z-y[0])-pio2_1t;
} else { /* near pi/2, use 24+24+24 bit pi */
z -= pio2_2;
y[0] = z - pio2_2t;
y[1] = (z-y[0])-pio2_2t;
}
return 1;
} else { /* negative x */
z = x + pio2_1;
if((ix&0xfffffff0)!=0x3fc90fd0) { /* 24+24 bit pi OK */
y[0] = z + pio2_1t;
y[1] = (z-y[0])+pio2_1t;
} else { /* near pi/2, use 24+24+24 bit pi */
z += pio2_2;
y[0] = z + pio2_2t;
y[1] = (z-y[0])+pio2_2t;
}
return -1;
}
}
if(ix<=0x43490f80) { /* |x| ~<= 2^7*(pi/2), medium size */
t = fabsf(x);
n = (int32_t) (t*invpio2+half);

View File

@ -11,7 +11,7 @@
*/
#ifndef lint
static char rcsid[] = "$Id: s_frexp.c,v 1.6 1994/08/18 23:06:49 jtc Exp $";
static char rcsid[] = "$Id: s_frexp.c,v 1.1.1.1 1994/08/19 09:39:51 jkh Exp $";
#endif
/*
@ -32,7 +32,6 @@ static const double
#else
static double
#endif
one = 1.00000000000000000000e+00, /* 0x3FF00000, 0x00000000 */
two54 = 1.80143985094819840000e+16; /* 0x43500000, 0x00000000 */
#ifdef __STDC__

View File

@ -14,7 +14,7 @@
*/
#ifndef lint
static char rcsid[] = "$Id: s_frexpf.c,v 1.2 1994/08/18 23:06:51 jtc Exp $";
static char rcsid[] = "$Id: s_frexpf.c,v 1.1.1.1 1994/08/19 09:39:58 jkh Exp $";
#endif
#include "math.h"
@ -25,7 +25,6 @@ static const float
#else
static float
#endif
one = 1.0000000000e+00, /* 0x3F800000 */
two25 = 3.3554432000e+07; /* 0x4c000000 */
#ifdef __STDC__