+2013-03-16 Joseph Myers <joseph@codesourcery.com>
+
+ [BZ #14155]
+ * sysdeps/ieee754/ldbl-128/e_j0l.c (__ieee754_j0l): Do not compute
+ 1 / x and functions P and Q for arguments above 0x1p256L.
+ (__ieee754_y0l): Likewise.
+ * sysdeps/ieee754/ldbl-128/e_j1l.c (__ieee754_j1l): Likewise.
+ (__ieee754_y1l): Likewise.
+ * math/libm-test.inc (j0_test): Do not allow spurious underflows.
+ (j1_test): Likewise.
+ (y0_test): Likewise.
+ (y1_test): Likewise.
+
2013-03-16 Thomas Schwinge <thomas@codesourcery.com>
* math/test-snan.c (TEST_FUNC): Add and use minus_sNaN_var
TEST_f_f (j0, 0x1.d7ce3ap+107L, 2.775523647291230802651040996274861694514e-17L);
#ifndef TEST_FLOAT
- /* Bug 14155: spurious exception may occur. */
- TEST_f_f (j0, -0x1.001000001p+593L, -3.927269966354206207832593635798954916263e-90L, UNDERFLOW_EXCEPTION_OK);
+ TEST_f_f (j0, -0x1.001000001p+593L, -3.927269966354206207832593635798954916263e-90L);
#endif
END (j0);
TEST_f_f (j1, 0x1.3ffp+74L, 1.818984347516051243459364437186082741567e-12L);
#ifndef TEST_FLOAT
- /* Bug 14155: spurious exception may occur. */
- TEST_f_f (j1, 0x1.ff00000000002p+840L, 1.846591691699331493194965158699937660696e-127L, UNDERFLOW_EXCEPTION_OK);
+ TEST_f_f (j1, 0x1.ff00000000002p+840L, 1.846591691699331493194965158699937660696e-127L);
#endif
END (j1);
TEST_f_f (y0, 0x1.3ffp+74L, 1.818984347516051243459467456433028748678e-12L);
#ifndef TEST_FLOAT
- /* Bug 14155: spurious exception may occur. */
- TEST_f_f (y0, 0x1.ff00000000002p+840L, 1.846591691699331493194965158699937660696e-127L, UNDERFLOW_EXCEPTION_OK);
+ TEST_f_f (y0, 0x1.ff00000000002p+840L, 1.846591691699331493194965158699937660696e-127L);
#endif
TEST_f_f (y0, 0x1p-10L, -4.4865150767109739412411806297168793661098L);
TEST_f_f (y1, 0x1.27e204p+99L, -8.881610148467797208469612080785210013461e-16L);
#ifndef TEST_FLOAT
- /* Bug 14155: spurious exception may occur. */
- TEST_f_f (y1, 0x1.001000001p+593L, 3.927269966354206207832593635798954916263e-90L, UNDERFLOW_EXCEPTION_OK);
+ TEST_f_f (y1, 0x1.001000001p+593L, 3.927269966354206207832593635798954916263e-90L);
#endif
TEST_f_f (y1, 0x1p-10L, -6.5190099301063115047395187618929589514382e+02L);
return p;
}
+ /* X = x - pi/4
+ cos(X) = cos(x) cos(pi/4) + sin(x) sin(pi/4)
+ = 1/sqrt(2) * (cos(x) + sin(x))
+ sin(X) = sin(x) cos(pi/4) - cos(x) sin(pi/4)
+ = 1/sqrt(2) * (sin(x) - cos(x))
+ sin(x) +- cos(x) = -cos(2x)/(sin(x) -+ cos(x))
+ cf. Fdlibm. */
+ __sincosl (xx, &s, &c);
+ ss = s - c;
+ cc = s + c;
+ z = -__cosl (xx + xx);
+ if ((s * c) < 0)
+ cc = z / ss;
+ else
+ ss = z / cc;
+
+ if (xx > 0x1p256L)
+ return ONEOSQPI * cc / __ieee754_sqrtl (xx);
+
xinv = 1.0L / xx;
z = xinv * xinv;
if (xinv <= 0.25)
p = 1.0L + z * p;
q = z * xinv * q;
q = q - 0.125L * xinv;
- /* X = x - pi/4
- cos(X) = cos(x) cos(pi/4) + sin(x) sin(pi/4)
- = 1/sqrt(2) * (cos(x) + sin(x))
- sin(X) = sin(x) cos(pi/4) - cos(x) sin(pi/4)
- = 1/sqrt(2) * (sin(x) - cos(x))
- sin(x) +- cos(x) = -cos(2x)/(sin(x) -+ cos(x))
- cf. Fdlibm. */
- __sincosl (xx, &s, &c);
- ss = s - c;
- cc = s + c;
- z = -__cosl (xx + xx);
- if ((s * c) < 0)
- cc = z / ss;
- else
- ss = z / cc;
z = ONEOSQPI * (p * cc - q * ss) / __ieee754_sqrtl (xx);
return z;
}
return p;
}
+ /* X = x - pi/4
+ cos(X) = cos(x) cos(pi/4) + sin(x) sin(pi/4)
+ = 1/sqrt(2) * (cos(x) + sin(x))
+ sin(X) = sin(x) cos(pi/4) - cos(x) sin(pi/4)
+ = 1/sqrt(2) * (sin(x) - cos(x))
+ sin(x) +- cos(x) = -cos(2x)/(sin(x) -+ cos(x))
+ cf. Fdlibm. */
+ __sincosl (x, &s, &c);
+ ss = s - c;
+ cc = s + c;
+ z = -__cosl (x + x);
+ if ((s * c) < 0)
+ cc = z / ss;
+ else
+ ss = z / cc;
+
+ if (xx > 0x1p256L)
+ return ONEOSQPI * ss / __ieee754_sqrtl (x);
+
xinv = 1.0L / xx;
z = xinv * xinv;
if (xinv <= 0.25)
p = 1.0L + z * p;
q = z * xinv * q;
q = q - 0.125L * xinv;
- /* X = x - pi/4
- cos(X) = cos(x) cos(pi/4) + sin(x) sin(pi/4)
- = 1/sqrt(2) * (cos(x) + sin(x))
- sin(X) = sin(x) cos(pi/4) - cos(x) sin(pi/4)
- = 1/sqrt(2) * (sin(x) - cos(x))
- sin(x) +- cos(x) = -cos(2x)/(sin(x) -+ cos(x))
- cf. Fdlibm. */
- __sincosl (x, &s, &c);
- ss = s - c;
- cc = s + c;
- z = -__cosl (x + x);
- if ((s * c) < 0)
- cc = z / ss;
- else
- ss = z / cc;
z = ONEOSQPI * (p * ss + q * cc) / __ieee754_sqrtl (x);
return z;
}
return p;
}
+ /* X = x - 3 pi/4
+ cos(X) = cos(x) cos(3 pi/4) + sin(x) sin(3 pi/4)
+ = 1/sqrt(2) * (-cos(x) + sin(x))
+ sin(X) = sin(x) cos(3 pi/4) - cos(x) sin(3 pi/4)
+ = -1/sqrt(2) * (sin(x) + cos(x))
+ cf. Fdlibm. */
+ __sincosl (xx, &s, &c);
+ ss = -s - c;
+ cc = s - c;
+ z = __cosl (xx + xx);
+ if ((s * c) > 0)
+ cc = z / ss;
+ else
+ ss = z / cc;
+
+ if (xx > 0x1p256L)
+ {
+ z = ONEOSQPI * cc / __ieee754_sqrtl (xx);
+ if (x < 0)
+ z = -z;
+ return z;
+ }
+
xinv = 1.0L / xx;
z = xinv * xinv;
if (xinv <= 0.25)
p = 1.0L + z * p;
q = z * q;
q = q * xinv + 0.375L * xinv;
- /* X = x - 3 pi/4
- cos(X) = cos(x) cos(3 pi/4) + sin(x) sin(3 pi/4)
- = 1/sqrt(2) * (-cos(x) + sin(x))
- sin(X) = sin(x) cos(3 pi/4) - cos(x) sin(3 pi/4)
- = -1/sqrt(2) * (sin(x) + cos(x))
- cf. Fdlibm. */
- __sincosl (xx, &s, &c);
- ss = -s - c;
- cc = s - c;
- z = __cosl (xx + xx);
- if ((s * c) > 0)
- cc = z / ss;
- else
- ss = z / cc;
z = ONEOSQPI * (p * cc - q * ss) / __ieee754_sqrtl (xx);
if (x < 0)
z = -z;
return p;
}
+ /* X = x - 3 pi/4
+ cos(X) = cos(x) cos(3 pi/4) + sin(x) sin(3 pi/4)
+ = 1/sqrt(2) * (-cos(x) + sin(x))
+ sin(X) = sin(x) cos(3 pi/4) - cos(x) sin(3 pi/4)
+ = -1/sqrt(2) * (sin(x) + cos(x))
+ cf. Fdlibm. */
+ __sincosl (xx, &s, &c);
+ ss = -s - c;
+ cc = s - c;
+ z = __cosl (xx + xx);
+ if ((s * c) > 0)
+ cc = z / ss;
+ else
+ ss = z / cc;
+
+ if (xx > 0x1p256L)
+ return ONEOSQPI * ss / __ieee754_sqrtl (xx);
+
xinv = 1.0L / xx;
z = xinv * xinv;
if (xinv <= 0.25)
p = 1.0L + z * p;
q = z * q;
q = q * xinv + 0.375L * xinv;
- /* X = x - 3 pi/4
- cos(X) = cos(x) cos(3 pi/4) + sin(x) sin(3 pi/4)
- = 1/sqrt(2) * (-cos(x) + sin(x))
- sin(X) = sin(x) cos(3 pi/4) - cos(x) sin(3 pi/4)
- = -1/sqrt(2) * (sin(x) + cos(x))
- cf. Fdlibm. */
- __sincosl (xx, &s, &c);
- ss = -s - c;
- cc = s - c;
- z = __cosl (xx + xx);
- if ((s * c) > 0)
- cc = z / ss;
- else
- ss = z / cc;
z = ONEOSQPI * (p * ss + q * cc) / __ieee754_sqrtl (xx);
return z;
}