diff options
-rw-r--r-- | ChangeLog | 24 | ||||
-rw-r--r-- | NEWS | 13 | ||||
-rw-r--r-- | math/auto-libm-test-in | 4 | ||||
-rw-r--r-- | math/auto-libm-test-out | 200 | ||||
-rw-r--r-- | sysdeps/ieee754/dbl-64/s_erf.c | 12 | ||||
-rw-r--r-- | sysdeps/ieee754/flt-32/s_erff.c | 13 | ||||
-rw-r--r-- | sysdeps/ieee754/ldbl-128/s_erfl.c | 16 | ||||
-rw-r--r-- | sysdeps/ieee754/ldbl-128ibm/s_erfl.c | 16 | ||||
-rw-r--r-- | sysdeps/ieee754/ldbl-96/s_erfl.c | 14 |
9 files changed, 289 insertions, 23 deletions
diff --git a/ChangeLog b/ChangeLog index 26720a95f0..62192f3b93 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,27 @@ +2014-05-14 Joseph Myers <joseph@codesourcery.com> + + [BZ #16516] + * sysdeps/ieee754/dbl-64/s_erf.c (efx8): Remove variable. + (__erf): Scale by 16 instead of 8 in potentially underflowing + case. Ensure exception if result actually underflows. + * sysdeps/ieee754/flt-32/s_erff.c (efx8): Remove variable. + (__erff): Scale by 16 instead of 8 in potentially underflowing + case. Ensure exception if result actually underflows. + * sysdeps/ieee754/ldbl-128/s_erfl.c: Include <float.h>. + (efx8): Remove variable. + (__erfl): Scale by 16 instead of 8 in potentially underflowing + case. Ensure exception if result actually underflows. + * sysdeps/ieee754/ldbl-128ibm/s_erfl.c: Include <float.h>. + (efx8): Remove variable. + (__erfl): Scale by 16 instead of 8 in potentially underflowing + case. Ensure exception if result actually underflows. + * sysdeps/ieee754/ldbl-96/s_erfl.c: Include <float.h>. + (efx8): Remove variable. + (__erfl): Scale by 16 instead of 8 in potentially underflowing + case. Ensure exception if result actually underflows. + * math/auto-libm-test-in: Add more tests of erf. + * math/auto-libm-test-out: Regenerated. + 2014-05-14 Andreas Schwab <schwab@suse.de> * elf/rtld.c (_dl_start_final, _dl_start, init_tls, dl_main): diff --git a/NEWS b/NEWS index f06e33524c..9293f802f8 100644 --- a/NEWS +++ b/NEWS @@ -11,12 +11,13 @@ Version 2.20 6804, 9894, 12994, 13347, 13651, 14308, 14770, 15119, 15347, 15514, 15804, 15894, 16002, 16064, 16198, 16284, 16348, 16349, 16357, 16362, 16447, - 16532, 16545, 16574, 16599, 16600, 16609, 16610, 16611, 16613, 16619, - 16623, 16629, 16632, 16634, 16639, 16642, 16648, 16649, 16670, 16674, - 16677, 16680, 16683, 16689, 16695, 16701, 16706, 16707, 16712, 16713, - 16714, 16731, 16739, 16740, 16743, 16754, 16758, 16759, 16760, 16770, - 16786, 16789, 16791, 16799, 16800, 16815, 16823, 16824, 16831, 16838, - 16854, 16876, 16877, 16885, 16888, 16890, 16912, 16916, 16922, 16932. + 16516, 16532, 16545, 16574, 16599, 16600, 16609, 16610, 16611, 16613, + 16619, 16623, 16629, 16632, 16634, 16639, 16642, 16648, 16649, 16670, + 16674, 16677, 16680, 16683, 16689, 16695, 16701, 16706, 16707, 16712, + 16713, 16714, 16731, 16739, 16740, 16743, 16754, 16758, 16759, 16760, + 16770, 16786, 16789, 16791, 16799, 16800, 16815, 16823, 16824, 16831, + 16838, 16854, 16876, 16877, 16885, 16888, 16890, 16912, 16916, 16922, + 16932. * The minimum Linux kernel version that this version of the GNU C Library can be used with is 2.6.32. diff --git a/math/auto-libm-test-in b/math/auto-libm-test-in index 420f657d81..da93a302cc 100644 --- a/math/auto-libm-test-in +++ b/math/auto-libm-test-in @@ -796,6 +796,10 @@ erf 4.125 erf 27.0 erf -27.0 erf -0x1.fffffffffffff8p-2 +erf 0x1.c5bf94p-127 +erf 0x3.8b7fa8p-128 +erf -0x3.8b7f12369ded8p-1024 +erf 0x3.8b7f12369ded5518p-16384 erfc 0.0 erfc -0 diff --git a/math/auto-libm-test-out b/math/auto-libm-test-out index 4a56804e3d..a0d919a8bd 100644 --- a/math/auto-libm-test-out +++ b/math/auto-libm-test-out @@ -87801,6 +87801,206 @@ erf -0x1.fffffffffffff8p-2 = erf tonearest ldbl-128ibm -0x7.ffffffffffffep-4L : -0x8.53f7ae0c76e8f9c90d4d08ca18p-4L : inexact-ok = erf towardzero ldbl-128ibm -0x7.ffffffffffffep-4L : -0x8.53f7ae0c76e8f9c90d4d08ca14p-4L : inexact-ok = erf upward ldbl-128ibm -0x7.ffffffffffffep-4L : -0x8.53f7ae0c76e8f9c90d4d08ca14p-4L : inexact-ok +erf 0x1.c5bf94p-127 += erf downward flt-32 0x3.8b7f28p-128f : 0x4.000018p-128f : inexact-ok += erf tonearest flt-32 0x3.8b7f28p-128f : 0x4.000018p-128f : inexact-ok += erf towardzero flt-32 0x3.8b7f28p-128f : 0x4.000018p-128f : inexact-ok += erf upward flt-32 0x3.8b7f28p-128f : 0x4.00002p-128f : inexact-ok += erf downward dbl-64 0x3.8b7f28p-128 : 0x4.000018956724p-128 : inexact-ok += erf tonearest dbl-64 0x3.8b7f28p-128 : 0x4.000018956724p-128 : inexact-ok += erf towardzero dbl-64 0x3.8b7f28p-128 : 0x4.000018956724p-128 : inexact-ok += erf upward dbl-64 0x3.8b7f28p-128 : 0x4.0000189567244p-128 : inexact-ok += erf downward ldbl-96-intel 0x3.8b7f28p-128L : 0x4.0000189567240f1p-128L : inexact-ok += erf tonearest ldbl-96-intel 0x3.8b7f28p-128L : 0x4.0000189567240f1p-128L : inexact-ok += erf towardzero ldbl-96-intel 0x3.8b7f28p-128L : 0x4.0000189567240f1p-128L : inexact-ok += erf upward ldbl-96-intel 0x3.8b7f28p-128L : 0x4.0000189567240f18p-128L : inexact-ok += erf downward ldbl-96-m68k 0x3.8b7f28p-128L : 0x4.0000189567240f1p-128L : inexact-ok += erf tonearest ldbl-96-m68k 0x3.8b7f28p-128L : 0x4.0000189567240f1p-128L : inexact-ok += erf towardzero ldbl-96-m68k 0x3.8b7f28p-128L : 0x4.0000189567240f1p-128L : inexact-ok += erf upward ldbl-96-m68k 0x3.8b7f28p-128L : 0x4.0000189567240f18p-128L : inexact-ok += erf downward ldbl-128 0x3.8b7f28p-128L : 0x4.0000189567240f10919b31d6bcf4p-128L : inexact-ok += erf tonearest ldbl-128 0x3.8b7f28p-128L : 0x4.0000189567240f10919b31d6bcf4p-128L : inexact-ok += erf towardzero ldbl-128 0x3.8b7f28p-128L : 0x4.0000189567240f10919b31d6bcf4p-128L : inexact-ok += erf upward ldbl-128 0x3.8b7f28p-128L : 0x4.0000189567240f10919b31d6bcf8p-128L : inexact-ok += erf downward ldbl-128ibm 0x3.8b7f28p-128L : 0x4.0000189567240f10919b31d6bcp-128L : inexact-ok += erf tonearest ldbl-128ibm 0x3.8b7f28p-128L : 0x4.0000189567240f10919b31d6bcp-128L : inexact-ok += erf towardzero ldbl-128ibm 0x3.8b7f28p-128L : 0x4.0000189567240f10919b31d6bcp-128L : inexact-ok += erf upward ldbl-128ibm 0x3.8b7f28p-128L : 0x4.0000189567240f10919b31d6bep-128L : inexact-ok +erf 0x3.8b7fa8p-128 += erf downward flt-32 0x3.8b7fa8p-128f : 0x4.0000a8p-128f : inexact-ok += erf tonearest flt-32 0x3.8b7fa8p-128f : 0x4.0000a8p-128f : inexact-ok += erf towardzero flt-32 0x3.8b7fa8p-128f : 0x4.0000a8p-128f : inexact-ok += erf upward flt-32 0x3.8b7fa8p-128f : 0x4.0000bp-128f : inexact-ok += erf downward dbl-64 0x3.8b7fa8p-128 : 0x4.0000a90421a6p-128 : inexact-ok += erf tonearest dbl-64 0x3.8b7fa8p-128 : 0x4.0000a90421a64p-128 : inexact-ok += erf towardzero dbl-64 0x3.8b7fa8p-128 : 0x4.0000a90421a6p-128 : inexact-ok += erf upward dbl-64 0x3.8b7fa8p-128 : 0x4.0000a90421a64p-128 : inexact-ok += erf downward ldbl-96-intel 0x3.8b7fa8p-128L : 0x4.0000a90421a623e8p-128L : inexact-ok += erf tonearest ldbl-96-intel 0x3.8b7fa8p-128L : 0x4.0000a90421a623e8p-128L : inexact-ok += erf towardzero ldbl-96-intel 0x3.8b7fa8p-128L : 0x4.0000a90421a623e8p-128L : inexact-ok += erf upward ldbl-96-intel 0x3.8b7fa8p-128L : 0x4.0000a90421a623fp-128L : inexact-ok += erf downward ldbl-96-m68k 0x3.8b7fa8p-128L : 0x4.0000a90421a623e8p-128L : inexact-ok += erf tonearest ldbl-96-m68k 0x3.8b7fa8p-128L : 0x4.0000a90421a623e8p-128L : inexact-ok += erf towardzero ldbl-96-m68k 0x3.8b7fa8p-128L : 0x4.0000a90421a623e8p-128L : inexact-ok += erf upward ldbl-96-m68k 0x3.8b7fa8p-128L : 0x4.0000a90421a623fp-128L : inexact-ok += erf downward ldbl-128 0x3.8b7fa8p-128L : 0x4.0000a90421a623ebfa28a3ab477p-128L : inexact-ok += erf tonearest ldbl-128 0x3.8b7fa8p-128L : 0x4.0000a90421a623ebfa28a3ab4774p-128L : inexact-ok += erf towardzero ldbl-128 0x3.8b7fa8p-128L : 0x4.0000a90421a623ebfa28a3ab477p-128L : inexact-ok += erf upward ldbl-128 0x3.8b7fa8p-128L : 0x4.0000a90421a623ebfa28a3ab4774p-128L : inexact-ok += erf downward ldbl-128ibm 0x3.8b7fa8p-128L : 0x4.0000a90421a623ebfa28a3ab46p-128L : inexact-ok += erf tonearest ldbl-128ibm 0x3.8b7fa8p-128L : 0x4.0000a90421a623ebfa28a3ab48p-128L : inexact-ok += erf towardzero ldbl-128ibm 0x3.8b7fa8p-128L : 0x4.0000a90421a623ebfa28a3ab46p-128L : inexact-ok += erf upward ldbl-128ibm 0x3.8b7fa8p-128L : 0x4.0000a90421a623ebfa28a3ab48p-128L : inexact-ok +erf -0x3.8b7f12369ded8p-1024 += erf downward flt-32 -0x0p+0f : -0x0p+0f : inexact-ok += erf tonearest flt-32 -0x0p+0f : -0x0p+0f : inexact-ok += erf towardzero flt-32 -0x0p+0f : -0x0p+0f : inexact-ok += erf upward flt-32 -0x0p+0f : -0x0p+0f : inexact-ok += erf downward dbl-64 -0x0p+0 : -0x0p+0 : inexact-ok += erf tonearest dbl-64 -0x0p+0 : -0x0p+0 : inexact-ok += erf towardzero dbl-64 -0x0p+0 : -0x0p+0 : inexact-ok += erf upward dbl-64 -0x0p+0 : -0x0p+0 : inexact-ok += erf downward ldbl-96-intel -0x0p+0L : -0x0p+0L : inexact-ok += erf tonearest ldbl-96-intel -0x0p+0L : -0x0p+0L : inexact-ok += erf towardzero ldbl-96-intel -0x0p+0L : -0x0p+0L : inexact-ok += erf upward ldbl-96-intel -0x0p+0L : -0x0p+0L : inexact-ok += erf downward ldbl-96-m68k -0x0p+0L : -0x0p+0L : inexact-ok += erf tonearest ldbl-96-m68k -0x0p+0L : -0x0p+0L : inexact-ok += erf towardzero ldbl-96-m68k -0x0p+0L : -0x0p+0L : inexact-ok += erf upward ldbl-96-m68k -0x0p+0L : -0x0p+0L : inexact-ok += erf downward ldbl-128 -0x0p+0L : -0x0p+0L : inexact-ok += erf tonearest ldbl-128 -0x0p+0L : -0x0p+0L : inexact-ok += erf towardzero ldbl-128 -0x0p+0L : -0x0p+0L : inexact-ok += erf upward ldbl-128 -0x0p+0L : -0x0p+0L : inexact-ok += erf downward ldbl-128ibm -0x0p+0L : -0x0p+0L : inexact-ok += erf tonearest ldbl-128ibm -0x0p+0L : -0x0p+0L : inexact-ok += erf towardzero ldbl-128ibm -0x0p+0L : -0x0p+0L : inexact-ok += erf upward ldbl-128ibm -0x0p+0L : -0x0p+0L : inexact-ok += erf downward flt-32 -0x8p-152f : -0x1p-148f : inexact-ok underflow errno-erange-ok += erf tonearest flt-32 -0x8p-152f : -0x8p-152f : inexact-ok underflow errno-erange-ok += erf towardzero flt-32 -0x8p-152f : -0x8p-152f : inexact-ok underflow errno-erange-ok += erf upward flt-32 -0x8p-152f : -0x8p-152f : inexact-ok underflow errno-erange-ok += erf downward dbl-64 -0x8p-152 : -0x9.06eba8214db7p-152 : inexact-ok += erf tonearest dbl-64 -0x8p-152 : -0x9.06eba8214db68p-152 : inexact-ok += erf towardzero dbl-64 -0x8p-152 : -0x9.06eba8214db68p-152 : inexact-ok += erf upward dbl-64 -0x8p-152 : -0x9.06eba8214db68p-152 : inexact-ok += erf downward ldbl-96-intel -0x8p-152L : -0x9.06eba8214db688ep-152L : inexact-ok += erf tonearest ldbl-96-intel -0x8p-152L : -0x9.06eba8214db688dp-152L : inexact-ok += erf towardzero ldbl-96-intel -0x8p-152L : -0x9.06eba8214db688dp-152L : inexact-ok += erf upward ldbl-96-intel -0x8p-152L : -0x9.06eba8214db688dp-152L : inexact-ok += erf downward ldbl-96-m68k -0x8p-152L : -0x9.06eba8214db688ep-152L : inexact-ok += erf tonearest ldbl-96-m68k -0x8p-152L : -0x9.06eba8214db688dp-152L : inexact-ok += erf towardzero ldbl-96-m68k -0x8p-152L : -0x9.06eba8214db688dp-152L : inexact-ok += erf upward ldbl-96-m68k -0x8p-152L : -0x9.06eba8214db688dp-152L : inexact-ok += erf downward ldbl-128 -0x8p-152L : -0x9.06eba8214db688d71d48a7f6bffp-152L : inexact-ok += erf tonearest ldbl-128 -0x8p-152L : -0x9.06eba8214db688d71d48a7f6bffp-152L : inexact-ok += erf towardzero ldbl-128 -0x8p-152L : -0x9.06eba8214db688d71d48a7f6bfe8p-152L : inexact-ok += erf upward ldbl-128 -0x8p-152L : -0x9.06eba8214db688d71d48a7f6bfe8p-152L : inexact-ok += erf downward ldbl-128ibm -0x8p-152L : -0x9.06eba8214db688d71d48a7f6cp-152L : inexact-ok += erf tonearest ldbl-128ibm -0x8p-152L : -0x9.06eba8214db688d71d48a7f6cp-152L : inexact-ok += erf towardzero ldbl-128ibm -0x8p-152L : -0x9.06eba8214db688d71d48a7f6bcp-152L : inexact-ok += erf upward ldbl-128ibm -0x8p-152L : -0x9.06eba8214db688d71d48a7f6bcp-152L : inexact-ok += erf downward dbl-64 -0x3.8b7f12369ded8p-1024 : -0x4.0000000000004p-1024 : inexact-ok += erf tonearest dbl-64 -0x3.8b7f12369ded8p-1024 : -0x4.0000000000004p-1024 : inexact-ok += erf towardzero dbl-64 -0x3.8b7f12369ded8p-1024 : -0x4p-1024 : inexact-ok += erf upward dbl-64 -0x3.8b7f12369ded8p-1024 : -0x4p-1024 : inexact-ok += erf downward ldbl-96-intel -0x3.8b7f12369ded8p-1024L : -0x4.0000000000003098p-1024L : inexact-ok += erf tonearest ldbl-96-intel -0x3.8b7f12369ded8p-1024L : -0x4.000000000000309p-1024L : inexact-ok += erf towardzero ldbl-96-intel -0x3.8b7f12369ded8p-1024L : -0x4.000000000000309p-1024L : inexact-ok += erf upward ldbl-96-intel -0x3.8b7f12369ded8p-1024L : -0x4.000000000000309p-1024L : inexact-ok += erf downward ldbl-96-m68k -0x3.8b7f12369ded8p-1024L : -0x4.0000000000003098p-1024L : inexact-ok += erf tonearest ldbl-96-m68k -0x3.8b7f12369ded8p-1024L : -0x4.000000000000309p-1024L : inexact-ok += erf towardzero ldbl-96-m68k -0x3.8b7f12369ded8p-1024L : -0x4.000000000000309p-1024L : inexact-ok += erf upward ldbl-96-m68k -0x3.8b7f12369ded8p-1024L : -0x4.000000000000309p-1024L : inexact-ok += erf downward ldbl-128 -0x3.8b7f12369ded8p-1024L : -0x4.00000000000030934524cf4ab6e4p-1024L : inexact-ok += erf tonearest ldbl-128 -0x3.8b7f12369ded8p-1024L : -0x4.00000000000030934524cf4ab6ep-1024L : inexact-ok += erf towardzero ldbl-128 -0x3.8b7f12369ded8p-1024L : -0x4.00000000000030934524cf4ab6ep-1024L : inexact-ok += erf upward ldbl-128 -0x3.8b7f12369ded8p-1024L : -0x4.00000000000030934524cf4ab6ep-1024L : inexact-ok += erf downward ldbl-128ibm -0x3.8b7f12369ded8p-1024L : -0x4.0000000000004p-1024L : inexact-ok underflow errno-erange-ok += erf tonearest ldbl-128ibm -0x3.8b7f12369ded8p-1024L : -0x4.0000000000004p-1024L : inexact-ok underflow errno-erange-ok += erf towardzero ldbl-128ibm -0x3.8b7f12369ded8p-1024L : -0x4p-1024L : inexact-ok underflow errno-erange-ok += erf upward ldbl-128ibm -0x3.8b7f12369ded8p-1024L : -0x4p-1024L : inexact-ok underflow errno-erange-ok +erf 0x3.8b7f12369ded5518p-16384 += erf downward flt-32 0x8p-152f : 0x8p-152f : inexact-ok underflow errno-erange-ok += erf tonearest flt-32 0x8p-152f : 0x8p-152f : inexact-ok underflow errno-erange-ok += erf towardzero flt-32 0x8p-152f : 0x8p-152f : inexact-ok underflow errno-erange-ok += erf upward flt-32 0x8p-152f : 0x1p-148f : inexact-ok underflow errno-erange-ok += erf downward dbl-64 0x8p-152 : 0x9.06eba8214db68p-152 : inexact-ok += erf tonearest dbl-64 0x8p-152 : 0x9.06eba8214db68p-152 : inexact-ok += erf towardzero dbl-64 0x8p-152 : 0x9.06eba8214db68p-152 : inexact-ok += erf upward dbl-64 0x8p-152 : 0x9.06eba8214db7p-152 : inexact-ok += erf downward ldbl-96-intel 0x8p-152L : 0x9.06eba8214db688dp-152L : inexact-ok += erf tonearest ldbl-96-intel 0x8p-152L : 0x9.06eba8214db688dp-152L : inexact-ok += erf towardzero ldbl-96-intel 0x8p-152L : 0x9.06eba8214db688dp-152L : inexact-ok += erf upward ldbl-96-intel 0x8p-152L : 0x9.06eba8214db688ep-152L : inexact-ok += erf downward ldbl-96-m68k 0x8p-152L : 0x9.06eba8214db688dp-152L : inexact-ok += erf tonearest ldbl-96-m68k 0x8p-152L : 0x9.06eba8214db688dp-152L : inexact-ok += erf towardzero ldbl-96-m68k 0x8p-152L : 0x9.06eba8214db688dp-152L : inexact-ok += erf upward ldbl-96-m68k 0x8p-152L : 0x9.06eba8214db688ep-152L : inexact-ok += erf downward ldbl-128 0x8p-152L : 0x9.06eba8214db688d71d48a7f6bfe8p-152L : inexact-ok += erf tonearest ldbl-128 0x8p-152L : 0x9.06eba8214db688d71d48a7f6bffp-152L : inexact-ok += erf towardzero ldbl-128 0x8p-152L : 0x9.06eba8214db688d71d48a7f6bfe8p-152L : inexact-ok += erf upward ldbl-128 0x8p-152L : 0x9.06eba8214db688d71d48a7f6bffp-152L : inexact-ok += erf downward ldbl-128ibm 0x8p-152L : 0x9.06eba8214db688d71d48a7f6bcp-152L : inexact-ok += erf tonearest ldbl-128ibm 0x8p-152L : 0x9.06eba8214db688d71d48a7f6cp-152L : inexact-ok += erf towardzero ldbl-128ibm 0x8p-152L : 0x9.06eba8214db688d71d48a7f6bcp-152L : inexact-ok += erf upward ldbl-128ibm 0x8p-152L : 0x9.06eba8214db688d71d48a7f6cp-152L : inexact-ok += erf downward flt-32 0x0p+0f : 0x0p+0f : inexact-ok += erf tonearest flt-32 0x0p+0f : 0x0p+0f : inexact-ok += erf towardzero flt-32 0x0p+0f : 0x0p+0f : inexact-ok += erf upward flt-32 0x0p+0f : 0x0p+0f : inexact-ok += erf downward dbl-64 0x0p+0 : 0x0p+0 : inexact-ok += erf tonearest dbl-64 0x0p+0 : 0x0p+0 : inexact-ok += erf towardzero dbl-64 0x0p+0 : 0x0p+0 : inexact-ok += erf upward dbl-64 0x0p+0 : 0x0p+0 : inexact-ok += erf downward ldbl-96-intel 0x0p+0L : 0x0p+0L : inexact-ok += erf tonearest ldbl-96-intel 0x0p+0L : 0x0p+0L : inexact-ok += erf towardzero ldbl-96-intel 0x0p+0L : 0x0p+0L : inexact-ok += erf upward ldbl-96-intel 0x0p+0L : 0x0p+0L : inexact-ok += erf downward ldbl-96-m68k 0x0p+0L : 0x0p+0L : inexact-ok += erf tonearest ldbl-96-m68k 0x0p+0L : 0x0p+0L : inexact-ok += erf towardzero ldbl-96-m68k 0x0p+0L : 0x0p+0L : inexact-ok += erf upward ldbl-96-m68k 0x0p+0L : 0x0p+0L : inexact-ok += erf downward ldbl-128 0x0p+0L : 0x0p+0L : inexact-ok += erf tonearest ldbl-128 0x0p+0L : 0x0p+0L : inexact-ok += erf towardzero ldbl-128 0x0p+0L : 0x0p+0L : inexact-ok += erf upward ldbl-128 0x0p+0L : 0x0p+0L : inexact-ok += erf downward ldbl-128ibm 0x0p+0L : 0x0p+0L : inexact-ok += erf tonearest ldbl-128ibm 0x0p+0L : 0x0p+0L : inexact-ok += erf towardzero ldbl-128ibm 0x0p+0L : 0x0p+0L : inexact-ok += erf upward ldbl-128ibm 0x0p+0L : 0x0p+0L : inexact-ok += erf downward dbl-64 0x4p-1076 : 0x4p-1076 : inexact-ok underflow errno-erange-ok += erf tonearest dbl-64 0x4p-1076 : 0x4p-1076 : inexact-ok underflow errno-erange-ok += erf towardzero dbl-64 0x4p-1076 : 0x4p-1076 : inexact-ok underflow errno-erange-ok += erf upward dbl-64 0x4p-1076 : 0x8p-1076 : inexact-ok underflow errno-erange-ok += erf downward ldbl-96-intel 0x4p-1076L : 0x4.8375d410a6db4468p-1076L : inexact-ok += erf tonearest ldbl-96-intel 0x4p-1076L : 0x4.8375d410a6db4468p-1076L : inexact-ok += erf towardzero ldbl-96-intel 0x4p-1076L : 0x4.8375d410a6db4468p-1076L : inexact-ok += erf upward ldbl-96-intel 0x4p-1076L : 0x4.8375d410a6db447p-1076L : inexact-ok += erf downward ldbl-96-m68k 0x4p-1076L : 0x4.8375d410a6db4468p-1076L : inexact-ok += erf tonearest ldbl-96-m68k 0x4p-1076L : 0x4.8375d410a6db4468p-1076L : inexact-ok += erf towardzero ldbl-96-m68k 0x4p-1076L : 0x4.8375d410a6db4468p-1076L : inexact-ok += erf upward ldbl-96-m68k 0x4p-1076L : 0x4.8375d410a6db447p-1076L : inexact-ok += erf downward ldbl-128 0x4p-1076L : 0x4.8375d410a6db446b8ea453fb5ff4p-1076L : inexact-ok += erf tonearest ldbl-128 0x4p-1076L : 0x4.8375d410a6db446b8ea453fb5ff8p-1076L : inexact-ok += erf towardzero ldbl-128 0x4p-1076L : 0x4.8375d410a6db446b8ea453fb5ff4p-1076L : inexact-ok += erf upward ldbl-128 0x4p-1076L : 0x4.8375d410a6db446b8ea453fb5ff8p-1076L : inexact-ok += erf downward ldbl-128ibm 0x4p-1076L : 0x4p-1076L : inexact-ok underflow errno-erange-ok += erf tonearest ldbl-128ibm 0x4p-1076L : 0x4p-1076L : inexact-ok underflow errno-erange-ok += erf towardzero ldbl-128ibm 0x4p-1076L : 0x4p-1076L : inexact-ok underflow errno-erange-ok += erf upward ldbl-128ibm 0x4p-1076L : 0x8p-1076L : inexact-ok underflow errno-erange-ok += erf downward ldbl-96-intel 0x3.8b7f12369ded5518p-16384L : 0x4.0000000000000028p-16384L : inexact-ok += erf tonearest ldbl-96-intel 0x3.8b7f12369ded5518p-16384L : 0x4.0000000000000028p-16384L : inexact-ok += erf towardzero ldbl-96-intel 0x3.8b7f12369ded5518p-16384L : 0x4.0000000000000028p-16384L : inexact-ok += erf upward ldbl-96-intel 0x3.8b7f12369ded5518p-16384L : 0x4.000000000000003p-16384L : inexact-ok += erf downward ldbl-96-m68k 0x3.8b7f12369ded5518p-16384L : 0x4.0000000000000028p-16384L : inexact-ok += erf tonearest ldbl-96-m68k 0x3.8b7f12369ded5518p-16384L : 0x4.0000000000000028p-16384L : inexact-ok += erf towardzero ldbl-96-m68k 0x3.8b7f12369ded5518p-16384L : 0x4.0000000000000028p-16384L : inexact-ok += erf upward ldbl-96-m68k 0x3.8b7f12369ded5518p-16384L : 0x4.000000000000003p-16384L : inexact-ok += erf downward ldbl-128 0x3.8b7f12369ded5518p-16384L : 0x4.0000000000000029274014aceae4p-16384L : inexact-ok += erf tonearest ldbl-128 0x3.8b7f12369ded5518p-16384L : 0x4.0000000000000029274014aceae4p-16384L : inexact-ok += erf towardzero ldbl-128 0x3.8b7f12369ded5518p-16384L : 0x4.0000000000000029274014aceae4p-16384L : inexact-ok += erf upward ldbl-128 0x3.8b7f12369ded5518p-16384L : 0x4.0000000000000029274014aceae8p-16384L : inexact-ok erfc 0.0 = erfc downward flt-32 0x0p+0f : 0x1p+0f : inexact-ok = erfc tonearest flt-32 0x0p+0f : 0x1p+0f : inexact-ok diff --git a/sysdeps/ieee754/dbl-64/s_erf.c b/sysdeps/ieee754/dbl-64/s_erf.c index 3f37397224..ea0a73424e 100644 --- a/sysdeps/ieee754/dbl-64/s_erf.c +++ b/sysdeps/ieee754/dbl-64/s_erf.c @@ -128,7 +128,6 @@ static const double * Coefficients for approximation to erf on [0,0.84375] */ efx = 1.28379167095512586316e-01, /* 0x3FC06EBA, 0x8214DB69 */ - efx8 = 1.02703333676410069053e+00, /* 0x3FF06EBA, 0x8214DB69 */ pp[] = { 1.28379167095512558561e-01, /* 0x3FC06EBA, 0x8214DB68 */ -3.25042107247001499370e-01, /* 0xBFD4CD7D, 0x691CB913 */ -2.84817495755985104766e-02, /* 0xBF9D2A51, 0xDBD7194F */ @@ -211,7 +210,16 @@ __erf (double x) if (ix < 0x3e300000) /* |x|<2**-28 */ { if (ix < 0x00800000) - return 0.125 * (8.0 * x + efx8 * x); /*avoid underflow */ + { + /* Avoid spurious underflow. */ + double ret = 0.0625 * (16.0 * x + (16.0 * efx) * x); + if (fabs (ret) < DBL_MIN) + { + double force_underflow = ret * ret; + math_force_eval (force_underflow); + } + return ret; + } return x + efx * x; } z = x * x; diff --git a/sysdeps/ieee754/flt-32/s_erff.c b/sysdeps/ieee754/flt-32/s_erff.c index 7c09589648..d23cff9293 100644 --- a/sysdeps/ieee754/flt-32/s_erff.c +++ b/sysdeps/ieee754/flt-32/s_erff.c @@ -33,7 +33,6 @@ erx = 8.4506291151e-01, /* 0x3f58560b */ * Coefficients for approximation to erf on [0,0.84375] */ efx = 1.2837916613e-01, /* 0x3e0375d4 */ -efx8= 1.0270333290e+00, /* 0x3f8375d4 */ pp0 = 1.2837916613e-01, /* 0x3e0375d4 */ pp1 = -3.2504209876e-01, /* 0xbea66beb */ pp2 = -2.8481749818e-02, /* 0xbce9528f */ @@ -111,8 +110,16 @@ float __erff(float x) if(ix < 0x3f580000) { /* |x|<0.84375 */ if(ix < 0x31800000) { /* |x|<2**-28 */ if (ix < 0x04000000) - /*avoid underflow */ - return (float)0.125*((float)8.0*x+efx8*x); + { + /* Avoid spurious underflow. */ + float ret = 0.0625f * (16.0f * x + (16.0f * efx) * x); + if (fabsf (ret) < FLT_MIN) + { + float force_underflow = ret * ret; + math_force_eval (force_underflow); + } + return ret; + } return x + efx*x; } z = x*x; diff --git a/sysdeps/ieee754/ldbl-128/s_erfl.c b/sysdeps/ieee754/ldbl-128/s_erfl.c index ef65ed8922..35ca8c1360 100644 --- a/sysdeps/ieee754/ldbl-128/s_erfl.c +++ b/sysdeps/ieee754/ldbl-128/s_erfl.c @@ -97,6 +97,7 @@ */ #include <errno.h> +#include <float.h> #include <math.h> #include <math_private.h> @@ -143,9 +144,7 @@ tiny = 1e-4931L, one = 1.0L, two = 2.0L, /* 2/sqrt(pi) - 1 */ - efx = 1.2837916709551257389615890312154517168810E-1L, - /* 8 * (2/sqrt(pi) - 1) */ - efx8 = 1.0270333367641005911692712249723613735048E0L; + efx = 1.2837916709551257389615890312154517168810E-1L; /* erf(x) = x + x R(x^2) @@ -782,7 +781,16 @@ __erfl (long double x) if (ix < 0x3fc60000) /* |x|<2**-57 */ { if (ix < 0x00080000) - return 0.125 * (8.0 * x + efx8 * x); /*avoid underflow */ + { + /* Avoid spurious underflow. */ + long double ret = 0.0625 * (16.0 * x + (16.0 * efx) * x); + if (fabsl (ret) < LDBL_MIN) + { + long double force_underflow = ret * ret; + math_force_eval (force_underflow); + } + return ret; + } return x + efx * x; } y = a + a * neval (z, TN1, NTN1) / deval (z, TD1, NTD1); diff --git a/sysdeps/ieee754/ldbl-128ibm/s_erfl.c b/sysdeps/ieee754/ldbl-128ibm/s_erfl.c index 95dc415845..f55e8b7879 100644 --- a/sysdeps/ieee754/ldbl-128ibm/s_erfl.c +++ b/sysdeps/ieee754/ldbl-128ibm/s_erfl.c @@ -102,6 +102,7 @@ */ #include <errno.h> +#include <float.h> #include <math.h> #include <math_private.h> #include <math_ldbl_opt.h> @@ -149,9 +150,7 @@ tiny = 1e-300L, one = 1.0L, two = 2.0L, /* 2/sqrt(pi) - 1 */ - efx = 1.2837916709551257389615890312154517168810E-1L, - /* 8 * (2/sqrt(pi) - 1) */ - efx8 = 1.0270333367641005911692712249723613735048E0L; + efx = 1.2837916709551257389615890312154517168810E-1L; /* erf(x) = x + x R(x^2) @@ -801,10 +800,17 @@ __erfl (long double x) if (ix < 0x00800000) { /* erf (-0) = -0. Unfortunately, for IBM extended double - 0.125 * (8.0 * x + efx8 * x) for x = -0 evaluates to 0. */ + 0.0625 * (16.0 * x + (16.0 * efx) * x) for x = -0 + evaluates to 0. */ if (x == 0) return x; - return 0.125 * (8.0 * x + efx8 * x); /*avoid underflow */ + long double ret = 0.0625 * (16.0 * x + (16.0 * efx) * x); + if (fabsl (ret) < LDBL_MIN) + { + long double force_underflow = ret * ret; + math_force_eval (force_underflow); + } + return ret; } return x + efx * x; } diff --git a/sysdeps/ieee754/ldbl-96/s_erfl.c b/sysdeps/ieee754/ldbl-96/s_erfl.c index 47e4b9e909..c27de812ca 100644 --- a/sysdeps/ieee754/ldbl-96/s_erfl.c +++ b/sysdeps/ieee754/ldbl-96/s_erfl.c @@ -105,6 +105,7 @@ #include <errno.h> +#include <float.h> #include <math.h> #include <math_private.h> @@ -120,8 +121,6 @@ tiny = 1e-4931L, */ /* 2/sqrt(pi) - 1 */ efx = 1.2837916709551257389615890312154517168810E-1L, - /* 8 * (2/sqrt(pi) - 1) */ - efx8 = 1.0270333367641005911692712249723613735048E0L, pp[6] = { 1.122751350964552113068262337278335028553E6L, @@ -272,7 +271,16 @@ __erfl (long double x) if (ix < 0x3fde8000) /* |x|<2**-33 */ { if (ix < 0x00080000) - return 0.125 * (8.0 * x + efx8 * x); /*avoid underflow */ + { + /* Avoid spurious underflow. */ + long double ret = 0.0625 * (16.0 * x + (16.0 * efx) * x); + if (fabsl (ret) < LDBL_MIN) + { + long double force_underflow = ret * ret; + math_force_eval (force_underflow); + } + return ret; + } return x + efx * x; } z = x * x; |