diff options
author | Alan Modra <amodra@gmail.com> | 2013-08-17 18:25:51 +0930 |
---|---|---|
committer | Alan Modra <amodra@gmail.com> | 2013-10-04 10:32:48 +0930 |
commit | 650ef4bd7976e36831cba22d838b567d3b5f6e8f (patch) | |
tree | cf3fc9761840792041ba623b931e925a3833386a /math | |
parent | 765714cafcad7e6168518c61111f07bd955a9fee (diff) | |
download | glibc-650ef4bd7976e36831cba22d838b567d3b5f6e8f.zip glibc-650ef4bd7976e36831cba22d838b567d3b5f6e8f.tar.gz glibc-650ef4bd7976e36831cba22d838b567d3b5f6e8f.tar.bz2 |
PowerPC floating point little-endian [4 of 15]
http://sourceware.org/ml/libc-alpha/2013-08/msg00084.html
Another batch of ieee854 macros and union replacement. These four
files also have bugs fixed with this patch. The fact that the two
doubles in an IBM long double may have different signs means that
negation and absolute value operations can't just twiddle one sign bit
as you can with ieee864 style extended double. fmodl, remainderl,
erfl and erfcl all had errors of this type. erfl also returned +1 for
large magnitude negative input where it should return -1. The hypotl
error is innocuous since the value adjusted twice is only used as a
flag. The e_hypotl.c tests for large "a" and small "b" are mutually
exclusive because we've already exited when x/y > 2**120. That allows
some further small simplifications.
[BZ #15734], [BZ #15735]
* sysdeps/ieee754/ldbl-128ibm/e_fmodl.c (__ieee754_fmodl): Rewrite
all uses of ieee875 long double macros and unions. Simplify test
for 0.0L. Correct |x|<|y| and |x|=|y| test. Use
ldbl_extract_mantissa value for ix,iy exponents. Properly
normalize after ldbl_extract_mantissa, and don't add hidden bit
already handled. Don't treat low word of ieee854 mantissa like
low word of IBM long double and mask off bit when testing for
zero.
* sysdeps/ieee754/ldbl-128ibm/e_hypotl.c (__ieee754_hypotl): Rewrite
all uses of ieee875 long double macros and unions. Simplify tests
for 0.0L and inf. Correct double adjustment of k. Delete dead code
adjusting ha,hb. Simplify code setting kld. Delete two600 and
two1022, instead use their values. Recognise that tests for large
"a" and small "b" are mutually exclusive. Rename vars. Comment.
* sysdeps/ieee754/ldbl-128ibm/e_remainderl.c (__ieee754_remainderl):
Rewrite all uses of ieee875 long double macros and unions. Simplify
test for 0.0L and nan. Correct negation.
* sysdeps/ieee754/ldbl-128ibm/s_erfl.c (__erfl): Rewrite all uses of
ieee875 long double macros and unions. Correct output for large
magnitude x. Correct absolute value calculation.
(__erfcl): Likewise.
* math/libm-test.inc: Add tests for errors discovered in IBM long
double versions of fmodl, remainderl, erfl and erfcl.
Diffstat (limited to 'math')
-rw-r--r-- | math/libm-test.inc | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/math/libm-test.inc b/math/libm-test.inc index 2cb3d2c..9677052 100644 --- a/math/libm-test.inc +++ b/math/libm-test.inc @@ -7829,6 +7829,11 @@ static const struct test_f_f_data erf_test_data[] = TEST_f_f (erf, 2.0L, 0.995322265018952734162069256367252929L), TEST_f_f (erf, 4.125L, 0.999999994576599200434933994687765914L), TEST_f_f (erf, 27.0L, 1.0L), + TEST_f_f (erf, -27.0L, -1.0L), +#if defined TEST_LDOUBLE && LDBL_MANT_DIG >= 54 + /* The input is not exactly representable as a double. */ + TEST_f_f (erf, -0x1.fffffffffffff8p-2L, -0.5204998778130465132916303345518417673509L), +#endif }; static void @@ -7857,6 +7862,10 @@ static const struct test_f_f_data erfc_test_data[] = TEST_f_f (erfc, 0x1.ffa002p+2L, 1.233585992097580296336099501489175967033e-29L), TEST_f_f (erfc, 0x1.ffffc8p+2L, 1.122671365033056305522366683719541099329e-29L), #ifdef TEST_LDOUBLE +# if LDBL_MANT_DIG >= 54 + /* The input is not exactly representable as a double. */ + TEST_f_f (erfc, -0x1.fffffffffffff8p-2L, 1.52049987781304651329163033455184176735L), +# endif /* The result can only be represented in long double. */ # if LDBL_MIN_10_EXP < -319 TEST_f_f (erfc, 27.0L, 0.523704892378925568501606768284954709e-318L), @@ -9355,6 +9364,13 @@ static const struct test_ff_f_data fmod_test_data[] = #if defined TEST_LDOUBLE && LDBL_MIN_EXP <= -16381 TEST_ff_f (fmod, 0x0.fffffffffffffffep-16382L, 0x1p-16445L, plus_zero, NO_INEXACT_EXCEPTION), #endif +#if defined TEST_LDOUBLE && LDBL_MANT_DIG >= 56 + TEST_ff_f (fmod, -0x1.00000000000004p+0L, 0x1.fffffffffffff8p-1L, -0x1p-53L, NO_INEXACT_EXCEPTION), + TEST_ff_f (fmod, 0x1.fffffffffffffap-1L, 0x1.fffffffffffff8p-1L, 0x1p-56L, NO_INEXACT_EXCEPTION), + TEST_ff_f (fmod, -0x1.fffffffffffffap-1L, 0x1.fffffffffffff8p-1L, -0x1p-56L, NO_INEXACT_EXCEPTION), + TEST_ff_f (fmod, 0x1.fffffffffffffap-1L, -0x1.fffffffffffff8p-1L, 0x1p-56L, NO_INEXACT_EXCEPTION), + TEST_ff_f (fmod, -0x1.fffffffffffffap-1L, -0x1.fffffffffffff8p-1L, -0x1p-56L, NO_INEXACT_EXCEPTION), +#endif }; static void @@ -12316,6 +12332,9 @@ static const struct test_ff_f_data remainder_test_data[] = TEST_ff_f (remainder, -1.625, -1.0, 0.375, NO_INEXACT_EXCEPTION), TEST_ff_f (remainder, 5.0, 2.0, 1.0, NO_INEXACT_EXCEPTION), TEST_ff_f (remainder, 3.0, 2.0, -1.0, NO_INEXACT_EXCEPTION), +#if defined TEST_LDOUBLE && LDBL_MANT_DIG >= 56 + TEST_ff_f (remainder, -0x1.80000000000002p1L, 2.0, 0x1.fffffffffffff8p-1L, NO_INEXACT_EXCEPTION), +#endif }; static void |