提交 9e2a895a 编写于 作者: R Rich Felker

fix loads of missing const in new libm, and some global vars (?!) in powl

上级 8e092217
......@@ -140,8 +140,8 @@ long double __cosl(long double, long double);
long double __tanl(long double, long double, int);
/* polynomial evaluation */
long double __polevll(long double, long double *, int);
long double __p1evll(long double, long double *, int);
long double __polevll(long double, const long double *, int);
long double __p1evll(long double, const long double *, int);
// FIXME: not needed when -fexcess-precision=standard is supported (>=gcc4.5)
/*
......
......@@ -60,7 +60,7 @@
* Polynomial evaluator:
* P[0] x^n + P[1] x^(n-1) + ... + P[n]
*/
long double __polevll(long double x, long double *P, int n)
long double __polevll(long double x, const long double *P, int n)
{
long double y;
......@@ -76,7 +76,7 @@ long double __polevll(long double x, long double *P, int n)
* Polynomial evaluator:
* x^n + P[0] x^(n-1) + P[1] x^(n-2) + ... + P[n]
*/
long double __p1evll(long double x, long double *P, int n)
long double __p1evll(long double x, const long double *P, int n)
{
long double y;
......
......@@ -39,7 +39,7 @@ static const double
one = 1.00000000000000000000e+00, /* 0x3FF00000, 0x00000000 */
pi = 3.14159265358979311600e+00, /* 0x400921FB, 0x54442D18 */
pio2_hi = 1.57079632679489655800e+00; /* 0x3FF921FB, 0x54442D18 */
static volatile double
static const volatile double
pio2_lo = 6.12323399573676603587e-17; /* 0x3C91A626, 0x33145C07 */
static const double
pS0 = 1.66666666666666657415e-01, /* 0x3FC55555, 0x55555555 */
......
......@@ -19,7 +19,7 @@ static const float
one = 1.0000000000e+00, /* 0x3F800000 */
pi = 3.1415925026e+00, /* 0x40490fda */
pio2_hi = 1.5707962513e+00; /* 0x3fc90fda */
static volatile float
static const volatile float
pio2_lo = 7.5497894159e-08; /* 0x33a22168 */
static const float
pS0 = 1.6666586697e-01,
......
......@@ -30,7 +30,7 @@ one = 1.00000000000000000000e+00;
// FIXME
//#ifdef __i386__
/* XXX Work around the fact that gcc truncates long double constants on i386 */
static volatile double
static const volatile double
pi1 = 3.14159265358979311600e+00, /* 0x1.921fb54442d18p+1 */
pi2 = 1.22514845490862001043e-16; /* 0x1.1a80000000000p-53 */
#define pi ((long double)pi1 + pi2)
......
......@@ -39,14 +39,14 @@
#include "libm.h"
static volatile double
static const volatile double
tiny = 1.0e-300;
static const double
zero = 0.0,
pi_o_4 = 7.8539816339744827900E-01, /* 0x3FE921FB, 0x54442D18 */
pi_o_2 = 1.5707963267948965580E+00, /* 0x3FF921FB, 0x54442D18 */
pi = 3.1415926535897931160E+00; /* 0x400921FB, 0x54442D18 */
static volatile double
static const volatile double
pi_lo = 1.2246467991473531772E-16; /* 0x3CA1A626, 0x33145C07 */
double atan2(double y, double x)
......
......@@ -15,14 +15,14 @@
#include "libm.h"
static volatile float
static const volatile float
tiny = 1.0e-30;
static const float
zero = 0.0,
pi_o_4 = 7.8539818525e-01, /* 0x3f490fdb */
pi_o_2 = 1.5707963705e+00, /* 0x3fc90fdb */
pi = 3.1415927410e+00; /* 0x40490fdb */
static volatile float
static const volatile float
pi_lo = -8.7422776573e-08; /* 0xb3bbbd2e */
float atan2f(float y, float x)
......
......@@ -24,12 +24,12 @@ long double atan2l(long double y, long double x)
}
#elif (LDBL_MANT_DIG == 64 || LDBL_MANT_DIG == 113) && LDBL_MAX_EXP == 16384
#include "__invtrigl.h"
static volatile long double
static const volatile long double
tiny = 1.0e-300;
static const long double
zero = 0.0;
/* XXX Work around the fact that gcc truncates long double constants on i386 */
static volatile double
static const volatile double
pi1 = 3.14159265358979311600e+00, /* 0x1.921fb54442d18p+1 */
pi2 = 1.22514845490862001043e-16; /* 0x1.1a80000000000p-53 */
#define pi ((long double)pi1 + pi2)
......
......@@ -90,7 +90,7 @@ P3 = 6.61375632143793436117e-05, /* 0x3F11566A, 0xAF25DE2C */
P4 = -1.65339022054652515390e-06, /* 0xBEBBBD41, 0xC5D26BF1 */
P5 = 4.13813679705723846039e-08; /* 0x3E663769, 0x72BEA4D0 */
static volatile double
static const volatile double
twom1000 = 9.33263618503218878990e-302; /* 2**-1000=0x01700000,0 */
double exp(double x)
......
......@@ -39,7 +39,7 @@ P3 = 0x1.c6b08d704a0a6p-5,
P4 = 0x1.3b2ab88f70400p-7,
P5 = 0x1.5d88003875c74p-10;
static volatile double twom1000 = 0x1p-1000;
static const volatile double twom1000 = 0x1p-1000;
static const double tbl[TBLSIZE * 2] = {
/* exp2(z + eps) eps */
......
......@@ -38,7 +38,7 @@ P2 = 0x1.ebfbe0p-3f,
P3 = 0x1.c6b348p-5f,
P4 = 0x1.3b2c9cp-7f;
static volatile float twom100 = 0x1p-100f;
static const volatile float twom100 = 0x1p-100f;
static const double exp2ft[TBLSIZE] = {
0x1.6a09e667f3bcdp-1,
......
......@@ -42,7 +42,7 @@ long double exp2l(long double x)
static const long double huge = 0x1p10000L;
/* XXX Prevent gcc from erroneously constant folding this. */
static volatile long double twom10000 = 0x1p-10000L;
static const volatile long double twom10000 = 0x1p-10000L;
static const double
redux = 0x1.8p63 / TBLSIZE,
......
......@@ -33,7 +33,7 @@ invln2 = 1.4426950216e+00, /* 0x3fb8aa3b */
P1 = 1.6666625440e-1, /* 0xaaaa8f.0p-26 */
P2 = -2.7667332906e-3; /* -0xb55215.0p-32 */
static volatile float twom100 = 7.8886090522e-31; /* 2**-100=0x0d800000 */
static const volatile float twom100 = 7.8886090522e-31; /* 2**-100=0x0d800000 */
float expf(float x)
{
......
......@@ -74,12 +74,12 @@ long double expl(long double x)
}
#elif LDBL_MANT_DIG == 64 && LDBL_MAX_EXP == 16384
static long double P[3] = {
static const long double P[3] = {
1.2617719307481059087798E-4L,
3.0299440770744196129956E-2L,
9.9999999999999999991025E-1L,
};
static long double Q[4] = {
static const long double Q[4] = {
3.0019850513866445504159E-6L,
2.5244834034968410419224E-3L,
2.2726554820815502876593E-1L,
......
......@@ -69,7 +69,7 @@ long double log10l(long double x)
* 1/sqrt(2) <= x < sqrt(2)
* Theoretical peak relative error = 6.2e-22
*/
static long double P[] = {
static const long double P[] = {
4.9962495940332550844739E-1L,
1.0767376367209449010438E1L,
7.7671073698359539859595E1L,
......@@ -78,7 +78,7 @@ static long double P[] = {
3.4258224542413922935104E2L,
1.0747524399916215149070E2L,
};
static long double Q[] = {
static const long double Q[] = {
/* 1.0000000000000000000000E0,*/
2.3479774160285863271658E1L,
1.9444210022760132894510E2L,
......@@ -94,13 +94,13 @@ static long double Q[] = {
* 1/sqrt(2) <= x < sqrt(2)
* Theoretical peak relative error = 6.16e-22
*/
static long double R[4] = {
static const long double R[4] = {
1.9757429581415468984296E-3L,
-7.1990767473014147232598E-1L,
1.0777257190312272158094E1L,
-3.5717684488096787370998E1L,
};
static long double S[4] = {
static const long double S[4] = {
/* 1.00000000000000000000E0L,*/
-2.6201045551331104417768E1L,
1.9361891836232102174846E2L,
......
......@@ -65,7 +65,7 @@ long double log1pl(long double x)
* 1/sqrt(2) <= x < sqrt(2)
* Theoretical peak relative error = 2.32e-20
*/
static long double P[] = {
static const long double P[] = {
4.5270000862445199635215E-5L,
4.9854102823193375972212E-1L,
6.5787325942061044846969E0L,
......@@ -74,7 +74,7 @@ static long double P[] = {
5.7112963590585538103336E1L,
2.0039553499201281259648E1L,
};
static long double Q[] = {
static const long double Q[] = {
/* 1.0000000000000000000000E0,*/
1.5062909083469192043167E1L,
8.3047565967967209469434E1L,
......@@ -89,13 +89,13 @@ static long double Q[] = {
* 1/sqrt(2) <= x < sqrt(2)
* Theoretical peak relative error = 6.16e-22
*/
static long double R[4] = {
static const long double R[4] = {
1.9757429581415468984296E-3L,
-7.1990767473014147232598E-1L,
1.0777257190312272158094E1L,
-3.5717684488096787370998E1L,
};
static long double S[4] = {
static const long double S[4] = {
/* 1.00000000000000000000E0L,*/
-2.6201045551331104417768E1L,
1.9361891836232102174846E2L,
......
......@@ -69,7 +69,7 @@ long double log2l(long double x)
* 1/sqrt(2) <= x < sqrt(2)
* Theoretical peak relative error = 6.2e-22
*/
static long double P[] = {
static const long double P[] = {
4.9962495940332550844739E-1L,
1.0767376367209449010438E1L,
7.7671073698359539859595E1L,
......@@ -78,7 +78,7 @@ static long double P[] = {
3.4258224542413922935104E2L,
1.0747524399916215149070E2L,
};
static long double Q[] = {
static const long double Q[] = {
/* 1.0000000000000000000000E0,*/
2.3479774160285863271658E1L,
1.9444210022760132894510E2L,
......@@ -94,13 +94,13 @@ static long double Q[] = {
* 1/sqrt(2) <= x < sqrt(2)
* Theoretical peak relative error = 6.16e-22
*/
static long double R[4] = {
static const long double R[4] = {
1.9757429581415468984296E-3L,
-7.1990767473014147232598E-1L,
1.0777257190312272158094E1L,
-3.5717684488096787370998E1L,
};
static long double S[4] = {
static const long double S[4] = {
/* 1.00000000000000000000E0L,*/
-2.6201045551331104417768E1L,
1.9361891836232102174846E2L,
......
......@@ -69,7 +69,7 @@ long double logl(long double x)
* 1/sqrt(2) <= x < sqrt(2)
* Theoretical peak relative error = 2.32e-20
*/
static long double P[] = {
static const long double P[] = {
4.5270000862445199635215E-5L,
4.9854102823193375972212E-1L,
6.5787325942061044846969E0L,
......@@ -78,7 +78,7 @@ static long double P[] = {
5.7112963590585538103336E1L,
2.0039553499201281259648E1L,
};
static long double Q[] = {
static const long double Q[] = {
/* 1.0000000000000000000000E0,*/
1.5062909083469192043167E1L,
8.3047565967967209469434E1L,
......@@ -93,13 +93,13 @@ static long double Q[] = {
* 1/sqrt(2) <= x < sqrt(2)
* Theoretical peak relative error = 6.16e-22
*/
static long double R[4] = {
static const long double R[4] = {
1.9757429581415468984296E-3L,
-7.1990767473014147232598E-1L,
1.0777257190312272158094E1L,
-3.5717684488096787370998E1L,
};
static long double S[4] = {
static const long double S[4] = {
/* 1.00000000000000000000E0L,*/
-2.6201045551331104417768E1L,
1.9361891836232102174846E2L,
......
......@@ -84,13 +84,13 @@ long double powl(long double x, long double y)
/* log(1+x) = x - .5x^2 + x^3 * P(z)/Q(z)
* on the domain 2^(-1/32) - 1 <= x <= 2^(1/32) - 1
*/
static long double P[] = {
static const long double P[] = {
8.3319510773868690346226E-4L,
4.9000050881978028599627E-1L,
1.7500123722550302671919E0L,
1.4000100839971580279335E0L,
};
static long double Q[] = {
static const long double Q[] = {
/* 1.0000000000000000000000E0L,*/
5.2500282295834889175431E0L,
8.4000598057587009834666E0L,
......@@ -99,7 +99,7 @@ static long double Q[] = {
/* A[i] = 2^(-i/32), rounded to IEEE long double precision.
* If i is even, A[i] + B[i/2] gives additional accuracy.
*/
static long double A[33] = {
static const long double A[33] = {
1.0000000000000000000000E0L,
9.7857206208770013448287E-1L,
9.5760328069857364691013E-1L,
......@@ -134,7 +134,7 @@ static long double A[33] = {
5.1094857432705833910408E-1L,
5.0000000000000000000000E-1L,
};
static long double B[17] = {
static const long double B[17] = {
0.0000000000000000000000E0L,
2.6176170809902549338711E-20L,
-1.0126791927256478897086E-20L,
......@@ -157,7 +157,7 @@ static long double B[17] = {
/* 2^x = 1 + x P(x),
* on the interval -1/32 <= x <= 0
*/
static long double R[] = {
static const long double R[] = {
1.5089970579127659901157E-5L,
1.5402715328927013076125E-4L,
1.3333556028915671091390E-3L,
......@@ -188,11 +188,9 @@ static long double R[] = {
static const long double MAXLOGL = 1.1356523406294143949492E4L;
static const long double MINLOGL = -1.13994985314888605586758E4L;
static const long double LOGE2L = 6.9314718055994530941723E-1L;
static volatile long double z;
static long double w, W, Wa, Wb, ya, yb, u;
static const long double huge = 0x1p10000L;
/* XXX Prevent gcc from erroneously constant folding this. */
static volatile long double twom10000 = 0x1p-10000L;
static const volatile long double twom10000 = 0x1p-10000L;
static long double reducl(long double);
static long double powil(long double, int);
......@@ -202,6 +200,8 @@ long double powl(long double x, long double y)
/* double F, Fa, Fb, G, Ga, Gb, H, Ha, Hb */
int i, nflg, iyflg, yoddint;
long e;
volatile long double z=0;
long double w=0, W=0, Wa=0, Wb=0, ya=0, yb=0, u=0;
if (y == 0.0L)
return 1.0L;
......
......@@ -68,7 +68,7 @@ n=7, d=8
Peak error = 1.83e-20
Relative error spread = 8.4e-23
*/
static long double P[8] = {
static const long double P[8] = {
4.212760487471622013093E-5L,
4.542931960608009155600E-4L,
4.092666828394035500949E-3L,
......@@ -78,7 +78,7 @@ static long double P[8] = {
8.378004301573126728826E-1L,
1.000000000000000000009E0L,
};
static long double Q[9] = {
static const long double Q[9] = {
-1.397148517476170440917E-5L,
2.346584059160635244282E-4L,
-1.237799246653152231188E-3L,
......@@ -91,7 +91,7 @@ static long double Q[9] = {
};
/*
static long double P[] = {
static const long double P[] = {
-3.01525602666895735709e0L,
-3.25157411956062339893e1L,
-2.92929976820724030353e2L,
......@@ -101,7 +101,7 @@ static long double P[] = {
-5.99650230220855581642e4L,
-7.15743521530849602425e4L
};
static long double Q[] = {
static const long double Q[] = {
1.00000000000000000000e0L,
-1.67955233807178858919e1L,
8.85946791747759881659e1L,
......@@ -125,7 +125,7 @@ n=8, d=0
Peak error = 9.44e-21
Relative error spread = 8.8e-4
*/
static long double STIR[9] = {
static const long double STIR[9] = {
7.147391378143610789273E-4L,
-2.363848809501759061727E-5L,
-5.950237554056330156018E-4L,
......@@ -145,7 +145,7 @@ static const long double SQTPI = 2.50662827463100050242E0L;
* 0 < x < 0.03125
* Peak relative error 4.2e-23
*/
static long double S[9] = {
static const long double S[9] = {
-1.193945051381510095614E-3L,
7.220599478036909672331E-3L,
-9.622023360406271645744E-3L,
......@@ -163,7 +163,7 @@ static long double S[9] = {
* Peak relative error 5.16e-23
* Relative error spread = 2.5e-24
*/
static long double SN[9] = {
static const long double SN[9] = {
1.133374167243894382010E-3L,
7.220837261893170325704E-3L,
9.621911155035976733706E-3L,
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册