summaryrefslogtreecommitdiffstats
path: root/lib/msun/src
diff options
context:
space:
mode:
Diffstat (limited to 'lib/msun/src')
-rw-r--r--lib/msun/src/e_rem_pio2.c2
-rw-r--r--lib/msun/src/e_rem_pio2f.c4
-rw-r--r--lib/msun/src/k_rem_pio2.c11
3 files changed, 11 insertions, 6 deletions
diff --git a/lib/msun/src/e_rem_pio2.c b/lib/msun/src/e_rem_pio2.c
index 96fc5c4..faf3a46 100644
--- a/lib/msun/src/e_rem_pio2.c
+++ b/lib/msun/src/e_rem_pio2.c
@@ -182,7 +182,7 @@ medium:
tx[2] = z;
nx = 3;
while(tx[nx-1]==zero) nx--; /* skip zero term */
- n = __kernel_rem_pio2(tx,y,e0,nx,2);
+ n = __kernel_rem_pio2(tx,y,e0,nx,1);
if(hx<0) {y[0] = -y[0]; y[1] = -y[1]; return -n;}
return n;
}
diff --git a/lib/msun/src/e_rem_pio2f.c b/lib/msun/src/e_rem_pio2f.c
index 60f8256..2cc4669 100644
--- a/lib/msun/src/e_rem_pio2f.c
+++ b/lib/msun/src/e_rem_pio2f.c
@@ -45,7 +45,7 @@ int
__ieee754_rem_pio2f(float x, float *y)
{
double w,r,fn;
- double tx[1],ty[2];
+ double tx[1],ty[1];
float z;
int32_t e0,n,ix,hx;
@@ -77,7 +77,7 @@ __ieee754_rem_pio2f(float x, float *y)
e0 = (ix>>23)-150; /* e0 = ilogb(|x|)-23; */
SET_FLOAT_WORD(z, ix - ((int32_t)(e0<<23)));
tx[0] = z;
- n = __kernel_rem_pio2(tx,ty,e0,1,1);
+ n = __kernel_rem_pio2(tx,ty,e0,1,0);
y[0] = ty[0];
y[1] = ty[0] - y[0];
if(hx<0) {y[0] = -y[0]; y[1] = -y[1]; return -n;}
diff --git a/lib/msun/src/k_rem_pio2.c b/lib/msun/src/k_rem_pio2.c
index 8abe6f8..a2ffca6 100644
--- a/lib/msun/src/k_rem_pio2.c
+++ b/lib/msun/src/k_rem_pio2.c
@@ -78,8 +78,13 @@ __FBSDID("$FreeBSD$");
* Here is the description of some local variables:
*
* jk jk+1 is the initial number of terms of ipio2[] needed
- * in the computation. The recommended value is 2,3,4,
- * 6 for single, double, extended,and quad.
+ * in the computation. The minimum and recommended value
+ * for jk is 3,4,4,6 for single, double, extended, and quad.
+ * jk+1 must be 2 larger than you might expect so that our
+ * recomputation test works. (Up to 24 bits in the integer
+ * part (the 24 bits of it that we compute) and 23 bits in
+ * the fraction part may be lost to cancelation before we
+ * recompute.)
*
* jz local integer variable indicating the number of
* terms of ipio2[] used.
@@ -129,7 +134,7 @@ __FBSDID("$FreeBSD$");
#include "math.h"
#include "math_private.h"
-static const int init_jk[] = {2,3,4,6}; /* initial value for jk */
+static const int init_jk[] = {3,4,4,6}; /* initial value for jk */
/*
* Table of constants for 2/pi, 396 Hex digits (476 decimal) of 2/pi
OpenPOWER on IntegriCloud