This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Fix erfc errno setting on underflow (bug 6786)
- From: "Joseph S. Myers" <joseph at codesourcery dot com>
- To: <libc-alpha at sourceware dot org>
- Date: Tue, 3 Dec 2013 01:25:57 +0000
- Subject: Fix erfc errno setting on underflow (bug 6786)
- Authentication-results: sourceware.org; auth=none
This patch, relative to a tree with
<https://sourceware.org/ml/libc-alpha/2013-12/msg00046.html> applied,
fixes bug 6786, missing errno setting from erfc on underflow, by
making the various erfc implementations check when they might be
returning 0 on underflow and set errno if so.
Tested x86_64 and x86 and ulps updated accordingly.
2013-12-03 Joseph Myers <joseph@codesourcery.com>
[BZ #6786]
* sysdeps/ieee754/dbl-64/s_erf.c: Include <errno.h> and <float.h>.
(__erfc): Set errno to ERANGE when returning 0 or tiny * tiny.
* sysdeps/ieee754/flt-32/s_erff.c: Include <errno.h> and
<float.h>.
(__erfcf): Set errno to ERANGE when returning 0 or tiny * tiny.
* sysdeps/ieee754/ldbl-128/s_erfl.c: Include <errno.h>.
(__erfcl): Set errno to ERANGE when returning 0 or tiny * tiny.
* sysdeps/ieee754/ldbl-128ibm/s_erfl.c: Include <errno.h>.
(__erfcl): Set errno to ERANGE when returning 0 or tiny * tiny.
* sysdeps/ieee754/ldbl-96/s_erfl.c: Include <errno.h>.
(__erfcl): Set errno to ERANGE when returning 0 or tiny * tiny.
* math/auto-libm-test-in: Don't allow missing errno from erfc.
Add more erfc tests.
* math/auto-libm-test-out: Regenerated.
* sysdeps/i386/fpu/libm-test-ulps: Update.
* sysdeps/x86_64/fpu/libm-test-ulps: Likewise.
diff --git a/math/auto-libm-test-in b/math/auto-libm-test-in
index 392cc57..126a9ea 100644
--- a/math/auto-libm-test-in
+++ b/math/auto-libm-test-in
@@ -149,9 +149,18 @@ erfc 4.125
erfc 0x1.ffa002p+2
erfc 0x1.ffffc8p+2
erfc -0x1.fffffffffffff8p-2
-# Bug 6786: errno may not be set on underflow.
-erfc 27.0 missing-errno
+erfc 26.0
+erfc 27.0
+erfc 28.0
erfc 0x1.ffff56789abcdef0123456789a8p+2
+erfc 100
+erfc 106
+erfc 106.5
+erfc 106.625
+erfc 107
+erfc 108
+erfc 1000
+erfc max
exp 0
exp -0
diff --git a/math/auto-libm-test-out b/math/auto-libm-test-out
index 8769a9d..9b3c398 100644
--- a/math/auto-libm-test-out
+++ b/math/auto-libm-test-out
@@ -5176,10 +5176,35 @@ erfc -0x1.fffffffffffff8p-2
= erfc tonearest ldbl-128ibm -0x7.ffffffffffffep-4L : 0x1.853f7ae0c76e8f9c90d4d08ca18p+0L : inexact-ok
= erfc towardzero ldbl-128ibm -0x7.ffffffffffffep-4L : 0x1.853f7ae0c76e8f9c90d4d08ca1p+0L : inexact-ok
= erfc upward ldbl-128ibm -0x7.ffffffffffffep-4L : 0x1.853f7ae0c76e8f9c90d4d08ca18p+0L : inexact-ok
-erfc 27.0 missing-errno
-= erfc downward flt-32 0x1.bp+4f : 0x0p+0f : inexact-ok underflow errno-erange errno-erange-ok
-= erfc tonearest flt-32 0x1.bp+4f : 0x0p+0f : inexact-ok underflow errno-erange errno-erange-ok
-= erfc towardzero flt-32 0x1.bp+4f : 0x0p+0f : inexact-ok underflow errno-erange errno-erange-ok
+erfc 26.0
+= erfc downward flt-32 0x1.ap+4f : 0x0p+0f : inexact-ok underflow errno-erange
+= erfc tonearest flt-32 0x1.ap+4f : 0x0p+0f : inexact-ok underflow errno-erange
+= erfc towardzero flt-32 0x1.ap+4f : 0x0p+0f : inexact-ok underflow errno-erange
+= erfc upward flt-32 0x1.ap+4f : 0x8p-152f : inexact-ok underflow errno-erange-ok
+= erfc downward dbl-64 0x1.ap+4 : 0x9.425ff0e6f5118p-984 : inexact-ok
+= erfc tonearest dbl-64 0x1.ap+4 : 0x9.425ff0e6f512p-984 : inexact-ok
+= erfc towardzero dbl-64 0x1.ap+4 : 0x9.425ff0e6f5118p-984 : inexact-ok
+= erfc upward dbl-64 0x1.ap+4 : 0x9.425ff0e6f512p-984 : inexact-ok
+= erfc downward ldbl-96-intel 0x1.ap+4L : 0x9.425ff0e6f511d74p-984L : inexact-ok
+= erfc tonearest ldbl-96-intel 0x1.ap+4L : 0x9.425ff0e6f511d75p-984L : inexact-ok
+= erfc towardzero ldbl-96-intel 0x1.ap+4L : 0x9.425ff0e6f511d74p-984L : inexact-ok
+= erfc upward ldbl-96-intel 0x1.ap+4L : 0x9.425ff0e6f511d75p-984L : inexact-ok
+= erfc downward ldbl-96-m68k 0x1.ap+4L : 0x9.425ff0e6f511d74p-984L : inexact-ok
+= erfc tonearest ldbl-96-m68k 0x1.ap+4L : 0x9.425ff0e6f511d75p-984L : inexact-ok
+= erfc towardzero ldbl-96-m68k 0x1.ap+4L : 0x9.425ff0e6f511d74p-984L : inexact-ok
+= erfc upward ldbl-96-m68k 0x1.ap+4L : 0x9.425ff0e6f511d75p-984L : inexact-ok
+= erfc downward ldbl-128 0x1.ap+4L : 0x9.425ff0e6f511d74db40cfbbceffp-984L : inexact-ok
+= erfc tonearest ldbl-128 0x1.ap+4L : 0x9.425ff0e6f511d74db40cfbbceffp-984L : inexact-ok
+= erfc towardzero ldbl-128 0x1.ap+4L : 0x9.425ff0e6f511d74db40cfbbceffp-984L : inexact-ok
+= erfc upward ldbl-128 0x1.ap+4L : 0x9.425ff0e6f511d74db40cfbbceff8p-984L : inexact-ok
+= erfc downward ldbl-128ibm 0x1.ap+4L : 0x9.425ff0e6f511d74db40cfb8p-984L : inexact-ok underflow errno-erange-ok
+= erfc tonearest ldbl-128ibm 0x1.ap+4L : 0x9.425ff0e6f511d74db40cfbcp-984L : inexact-ok underflow errno-erange-ok
+= erfc towardzero ldbl-128ibm 0x1.ap+4L : 0x9.425ff0e6f511d74db40cfb8p-984L : inexact-ok underflow errno-erange-ok
+= erfc upward ldbl-128ibm 0x1.ap+4L : 0x9.425ff0e6f511d74db40cfbcp-984L : inexact-ok underflow errno-erange-ok
+erfc 27.0
+= erfc downward flt-32 0x1.bp+4f : 0x0p+0f : inexact-ok underflow errno-erange
+= erfc tonearest flt-32 0x1.bp+4f : 0x0p+0f : inexact-ok underflow errno-erange
+= erfc towardzero flt-32 0x1.bp+4f : 0x0p+0f : inexact-ok underflow errno-erange
= erfc upward flt-32 0x1.bp+4f : 0x8p-152f : inexact-ok underflow errno-erange-ok
= erfc downward dbl-64 0x1.bp+4 : 0x6.783cp-1060 : inexact-ok underflow errno-erange-ok
= erfc tonearest dbl-64 0x1.bp+4 : 0x6.783cp-1060 : inexact-ok underflow errno-erange-ok
@@ -5201,6 +5226,31 @@ erfc 27.0 missing-errno
= erfc tonearest ldbl-128ibm 0x1.bp+4L : 0x6.783cp-1060L : inexact-ok underflow errno-erange-ok
= erfc towardzero ldbl-128ibm 0x1.bp+4L : 0x6.783cp-1060L : inexact-ok underflow errno-erange-ok
= erfc upward ldbl-128ibm 0x1.bp+4L : 0x6.784p-1060L : inexact-ok underflow errno-erange-ok
+erfc 28.0
+= erfc downward flt-32 0x1.cp+4f : 0x0p+0f : inexact-ok underflow errno-erange
+= erfc tonearest flt-32 0x1.cp+4f : 0x0p+0f : inexact-ok underflow errno-erange
+= erfc towardzero flt-32 0x1.cp+4f : 0x0p+0f : inexact-ok underflow errno-erange
+= erfc upward flt-32 0x1.cp+4f : 0x8p-152f : inexact-ok underflow errno-erange-ok
+= erfc downward dbl-64 0x1.cp+4 : 0x0p+0 : inexact-ok underflow errno-erange
+= erfc tonearest dbl-64 0x1.cp+4 : 0x0p+0 : inexact-ok underflow errno-erange
+= erfc towardzero dbl-64 0x1.cp+4 : 0x0p+0 : inexact-ok underflow errno-erange
+= erfc upward dbl-64 0x1.cp+4 : 0x4p-1076 : inexact-ok underflow errno-erange-ok
+= erfc downward ldbl-96-intel 0x1.cp+4L : 0x9.cd4b80875a8ec66p-1140L : inexact-ok
+= erfc tonearest ldbl-96-intel 0x1.cp+4L : 0x9.cd4b80875a8ec66p-1140L : inexact-ok
+= erfc towardzero ldbl-96-intel 0x1.cp+4L : 0x9.cd4b80875a8ec66p-1140L : inexact-ok
+= erfc upward ldbl-96-intel 0x1.cp+4L : 0x9.cd4b80875a8ec67p-1140L : inexact-ok
+= erfc downward ldbl-96-m68k 0x1.cp+4L : 0x9.cd4b80875a8ec66p-1140L : inexact-ok
+= erfc tonearest ldbl-96-m68k 0x1.cp+4L : 0x9.cd4b80875a8ec66p-1140L : inexact-ok
+= erfc towardzero ldbl-96-m68k 0x1.cp+4L : 0x9.cd4b80875a8ec66p-1140L : inexact-ok
+= erfc upward ldbl-96-m68k 0x1.cp+4L : 0x9.cd4b80875a8ec67p-1140L : inexact-ok
+= erfc downward ldbl-128 0x1.cp+4L : 0x9.cd4b80875a8ec6603b9a1f1beadp-1140L : inexact-ok
+= erfc tonearest ldbl-128 0x1.cp+4L : 0x9.cd4b80875a8ec6603b9a1f1bead8p-1140L : inexact-ok
+= erfc towardzero ldbl-128 0x1.cp+4L : 0x9.cd4b80875a8ec6603b9a1f1beadp-1140L : inexact-ok
+= erfc upward ldbl-128 0x1.cp+4L : 0x9.cd4b80875a8ec6603b9a1f1bead8p-1140L : inexact-ok
+= erfc downward ldbl-128ibm 0x1.cp+4L : 0x0p+0L : inexact-ok underflow errno-erange
+= erfc tonearest ldbl-128ibm 0x1.cp+4L : 0x0p+0L : inexact-ok underflow errno-erange
+= erfc towardzero ldbl-128ibm 0x1.cp+4L : 0x0p+0L : inexact-ok underflow errno-erange
+= erfc upward ldbl-128ibm 0x1.cp+4L : 0x4p-1076L : inexact-ok underflow errno-erange-ok
erfc 0x1.ffff56789abcdef0123456789a8p+2
= erfc downward flt-32 0x7.fffd6p+0f : 0xe.3cd88p-100f : inexact-ok
= erfc tonearest flt-32 0x7.fffd6p+0f : 0xe.3cd88p-100f : inexact-ok
@@ -5330,6 +5380,250 @@ erfc 0x1.ffff56789abcdef0123456789a8p+2
= erfc tonearest ldbl-128ibm 0x7.fffd59e26af37bc048d159e26ap+0L : 0xe.3cddffbbe84faf818649c2377p-100L : inexact-ok
= erfc towardzero ldbl-128ibm 0x7.fffd59e26af37bc048d159e26ap+0L : 0xe.3cddffbbe84faf818649c2377p-100L : inexact-ok
= erfc upward ldbl-128ibm 0x7.fffd59e26af37bc048d159e26ap+0L : 0xe.3cddffbbe84faf818649c23774p-100L : inexact-ok
+erfc 100
+= erfc downward flt-32 0x6.4p+4f : 0x0p+0f : inexact-ok underflow errno-erange
+= erfc tonearest flt-32 0x6.4p+4f : 0x0p+0f : inexact-ok underflow errno-erange
+= erfc towardzero flt-32 0x6.4p+4f : 0x0p+0f : inexact-ok underflow errno-erange
+= erfc upward flt-32 0x6.4p+4f : 0x8p-152f : inexact-ok underflow errno-erange-ok
+= erfc downward dbl-64 0x6.4p+4 : 0x0p+0 : inexact-ok underflow errno-erange
+= erfc tonearest dbl-64 0x6.4p+4 : 0x0p+0 : inexact-ok underflow errno-erange
+= erfc towardzero dbl-64 0x6.4p+4 : 0x0p+0 : inexact-ok underflow errno-erange
+= erfc upward dbl-64 0x6.4p+4 : 0x4p-1076 : inexact-ok underflow errno-erange-ok
+= erfc downward ldbl-96-intel 0x6.4p+4L : 0x2.fd514cef7750e588p-14436L : inexact-ok
+= erfc tonearest ldbl-96-intel 0x6.4p+4L : 0x2.fd514cef7750e588p-14436L : inexact-ok
+= erfc towardzero ldbl-96-intel 0x6.4p+4L : 0x2.fd514cef7750e588p-14436L : inexact-ok
+= erfc upward ldbl-96-intel 0x6.4p+4L : 0x2.fd514cef7750e58cp-14436L : inexact-ok
+= erfc downward ldbl-96-m68k 0x6.4p+4L : 0x2.fd514cef7750e588p-14436L : inexact-ok
+= erfc tonearest ldbl-96-m68k 0x6.4p+4L : 0x2.fd514cef7750e588p-14436L : inexact-ok
+= erfc towardzero ldbl-96-m68k 0x6.4p+4L : 0x2.fd514cef7750e588p-14436L : inexact-ok
+= erfc upward ldbl-96-m68k 0x6.4p+4L : 0x2.fd514cef7750e58cp-14436L : inexact-ok
+= erfc downward ldbl-128 0x6.4p+4L : 0x2.fd514cef7750e58906601ff35dcp-14436L : inexact-ok
+= erfc tonearest ldbl-128 0x6.4p+4L : 0x2.fd514cef7750e58906601ff35dcp-14436L : inexact-ok
+= erfc towardzero ldbl-128 0x6.4p+4L : 0x2.fd514cef7750e58906601ff35dcp-14436L : inexact-ok
+= erfc upward ldbl-128 0x6.4p+4L : 0x2.fd514cef7750e58906601ff35dc2p-14436L : inexact-ok
+= erfc downward ldbl-128ibm 0x6.4p+4L : 0x0p+0L : inexact-ok underflow errno-erange
+= erfc tonearest ldbl-128ibm 0x6.4p+4L : 0x0p+0L : inexact-ok underflow errno-erange
+= erfc towardzero ldbl-128ibm 0x6.4p+4L : 0x0p+0L : inexact-ok underflow errno-erange
+= erfc upward ldbl-128ibm 0x6.4p+4L : 0x4p-1076L : inexact-ok underflow errno-erange-ok
+erfc 106
+= erfc downward flt-32 0x6.ap+4f : 0x0p+0f : inexact-ok underflow errno-erange
+= erfc tonearest flt-32 0x6.ap+4f : 0x0p+0f : inexact-ok underflow errno-erange
+= erfc towardzero flt-32 0x6.ap+4f : 0x0p+0f : inexact-ok underflow errno-erange
+= erfc upward flt-32 0x6.ap+4f : 0x8p-152f : inexact-ok underflow errno-erange-ok
+= erfc downward dbl-64 0x6.ap+4 : 0x0p+0 : inexact-ok underflow errno-erange
+= erfc tonearest dbl-64 0x6.ap+4 : 0x0p+0 : inexact-ok underflow errno-erange
+= erfc towardzero dbl-64 0x6.ap+4 : 0x0p+0 : inexact-ok underflow errno-erange
+= erfc upward dbl-64 0x6.ap+4 : 0x4p-1076 : inexact-ok underflow errno-erange-ok
+= erfc downward ldbl-96-intel 0x6.ap+4L : 0x5.028a2f1656a432dp-16220L : inexact-ok
+= erfc tonearest ldbl-96-intel 0x6.ap+4L : 0x5.028a2f1656a432d8p-16220L : inexact-ok
+= erfc towardzero ldbl-96-intel 0x6.ap+4L : 0x5.028a2f1656a432dp-16220L : inexact-ok
+= erfc upward ldbl-96-intel 0x6.ap+4L : 0x5.028a2f1656a432d8p-16220L : inexact-ok
+= erfc downward ldbl-96-m68k 0x6.ap+4L : 0x5.028a2f1656a432dp-16220L : inexact-ok
+= erfc tonearest ldbl-96-m68k 0x6.ap+4L : 0x5.028a2f1656a432d8p-16220L : inexact-ok
+= erfc towardzero ldbl-96-m68k 0x6.ap+4L : 0x5.028a2f1656a432dp-16220L : inexact-ok
+= erfc upward ldbl-96-m68k 0x6.ap+4L : 0x5.028a2f1656a432d8p-16220L : inexact-ok
+= erfc downward ldbl-128 0x6.ap+4L : 0x5.028a2f1656a432d79f76a6f2df48p-16220L : inexact-ok
+= erfc tonearest ldbl-128 0x6.ap+4L : 0x5.028a2f1656a432d79f76a6f2df48p-16220L : inexact-ok
+= erfc towardzero ldbl-128 0x6.ap+4L : 0x5.028a2f1656a432d79f76a6f2df48p-16220L : inexact-ok
+= erfc upward ldbl-128 0x6.ap+4L : 0x5.028a2f1656a432d79f76a6f2df4cp-16220L : inexact-ok
+= erfc downward ldbl-128ibm 0x6.ap+4L : 0x0p+0L : inexact-ok underflow errno-erange
+= erfc tonearest ldbl-128ibm 0x6.ap+4L : 0x0p+0L : inexact-ok underflow errno-erange
+= erfc towardzero ldbl-128ibm 0x6.ap+4L : 0x0p+0L : inexact-ok underflow errno-erange
+= erfc upward ldbl-128ibm 0x6.ap+4L : 0x4p-1076L : inexact-ok underflow errno-erange-ok
+erfc 106.5
+= erfc downward flt-32 0x6.a8p+4f : 0x0p+0f : inexact-ok underflow errno-erange
+= erfc tonearest flt-32 0x6.a8p+4f : 0x0p+0f : inexact-ok underflow errno-erange
+= erfc towardzero flt-32 0x6.a8p+4f : 0x0p+0f : inexact-ok underflow errno-erange
+= erfc upward flt-32 0x6.a8p+4f : 0x8p-152f : inexact-ok underflow errno-erange-ok
+= erfc downward dbl-64 0x6.a8p+4 : 0x0p+0 : inexact-ok underflow errno-erange
+= erfc tonearest dbl-64 0x6.a8p+4 : 0x0p+0 : inexact-ok underflow errno-erange
+= erfc towardzero dbl-64 0x6.a8p+4 : 0x0p+0 : inexact-ok underflow errno-erange
+= erfc upward dbl-64 0x6.a8p+4 : 0x4p-1076 : inexact-ok underflow errno-erange-ok
+= erfc downward ldbl-96-intel 0x6.a8p+4L : 0x2.0b5b5b3bbf7d96a4p-16372L : inexact-ok
+= erfc tonearest ldbl-96-intel 0x6.a8p+4L : 0x2.0b5b5b3bbf7d96a4p-16372L : inexact-ok
+= erfc towardzero ldbl-96-intel 0x6.a8p+4L : 0x2.0b5b5b3bbf7d96a4p-16372L : inexact-ok
+= erfc upward ldbl-96-intel 0x6.a8p+4L : 0x2.0b5b5b3bbf7d96a8p-16372L : inexact-ok
+= erfc downward ldbl-96-m68k 0x6.a8p+4L : 0x2.0b5b5b3bbf7d96a4p-16372L : inexact-ok
+= erfc tonearest ldbl-96-m68k 0x6.a8p+4L : 0x2.0b5b5b3bbf7d96a4p-16372L : inexact-ok
+= erfc towardzero ldbl-96-m68k 0x6.a8p+4L : 0x2.0b5b5b3bbf7d96a4p-16372L : inexact-ok
+= erfc upward ldbl-96-m68k 0x6.a8p+4L : 0x2.0b5b5b3bbf7d96a8p-16372L : inexact-ok
+= erfc downward ldbl-128 0x6.a8p+4L : 0x2.0b5b5b3bbf7d96a5e595291fc8c4p-16372L : inexact-ok
+= erfc tonearest ldbl-128 0x6.a8p+4L : 0x2.0b5b5b3bbf7d96a5e595291fc8c4p-16372L : inexact-ok
+= erfc towardzero ldbl-128 0x6.a8p+4L : 0x2.0b5b5b3bbf7d96a5e595291fc8c4p-16372L : inexact-ok
+= erfc upward ldbl-128 0x6.a8p+4L : 0x2.0b5b5b3bbf7d96a5e595291fc8c6p-16372L : inexact-ok
+= erfc downward ldbl-128ibm 0x6.a8p+4L : 0x0p+0L : inexact-ok underflow errno-erange
+= erfc tonearest ldbl-128ibm 0x6.a8p+4L : 0x0p+0L : inexact-ok underflow errno-erange
+= erfc towardzero ldbl-128ibm 0x6.a8p+4L : 0x0p+0L : inexact-ok underflow errno-erange
+= erfc upward ldbl-128ibm 0x6.a8p+4L : 0x4p-1076L : inexact-ok underflow errno-erange-ok
+erfc 106.625
+= erfc downward flt-32 0x6.aap+4f : 0x0p+0f : inexact-ok underflow errno-erange
+= erfc tonearest flt-32 0x6.aap+4f : 0x0p+0f : inexact-ok underflow errno-erange
+= erfc towardzero flt-32 0x6.aap+4f : 0x0p+0f : inexact-ok underflow errno-erange
+= erfc upward flt-32 0x6.aap+4f : 0x8p-152f : inexact-ok underflow errno-erange-ok
+= erfc downward dbl-64 0x6.aap+4 : 0x0p+0 : inexact-ok underflow errno-erange
+= erfc tonearest dbl-64 0x6.aap+4 : 0x0p+0 : inexact-ok underflow errno-erange
+= erfc towardzero dbl-64 0x6.aap+4 : 0x0p+0 : inexact-ok underflow errno-erange
+= erfc upward dbl-64 0x6.aap+4 : 0x4p-1076 : inexact-ok underflow errno-erange-ok
+= erfc downward ldbl-96-intel 0x6.aap+4L : 0x6.0b6ee9978p-16412L : inexact-ok underflow errno-erange-ok
+= erfc tonearest ldbl-96-intel 0x6.aap+4L : 0x6.0b6ee998p-16412L : inexact-ok underflow errno-erange-ok
+= erfc towardzero ldbl-96-intel 0x6.aap+4L : 0x6.0b6ee9978p-16412L : inexact-ok underflow errno-erange-ok
+= erfc upward ldbl-96-intel 0x6.aap+4L : 0x6.0b6ee998p-16412L : inexact-ok underflow errno-erange-ok
+= erfc downward ldbl-96-m68k 0x6.aap+4L : 0x6.0b6ee997cp-16412L : inexact-ok underflow errno-erange-ok
+= erfc tonearest ldbl-96-m68k 0x6.aap+4L : 0x6.0b6ee997cp-16412L : inexact-ok underflow errno-erange-ok
+= erfc towardzero ldbl-96-m68k 0x6.aap+4L : 0x6.0b6ee997cp-16412L : inexact-ok underflow errno-erange-ok
+= erfc upward ldbl-96-m68k 0x6.aap+4L : 0x6.0b6ee998p-16412L : inexact-ok underflow errno-erange-ok
+= erfc downward ldbl-128 0x6.aap+4L : 0x6.0b6ee997d3343b5bf2f08p-16412L : inexact-ok underflow errno-erange-ok
+= erfc tonearest ldbl-128 0x6.aap+4L : 0x6.0b6ee997d3343b5bf2f08p-16412L : inexact-ok underflow errno-erange-ok
+= erfc towardzero ldbl-128 0x6.aap+4L : 0x6.0b6ee997d3343b5bf2f08p-16412L : inexact-ok underflow errno-erange-ok
+= erfc upward ldbl-128 0x6.aap+4L : 0x6.0b6ee997d3343b5bf2f0cp-16412L : inexact-ok underflow errno-erange-ok
+= erfc downward ldbl-128ibm 0x6.aap+4L : 0x0p+0L : inexact-ok underflow errno-erange
+= erfc tonearest ldbl-128ibm 0x6.aap+4L : 0x0p+0L : inexact-ok underflow errno-erange
+= erfc towardzero ldbl-128ibm 0x6.aap+4L : 0x0p+0L : inexact-ok underflow errno-erange
+= erfc upward ldbl-128ibm 0x6.aap+4L : 0x4p-1076L : inexact-ok underflow errno-erange-ok
+erfc 107
+= erfc downward flt-32 0x6.bp+4f : 0x0p+0f : inexact-ok underflow errno-erange
+= erfc tonearest flt-32 0x6.bp+4f : 0x0p+0f : inexact-ok underflow errno-erange
+= erfc towardzero flt-32 0x6.bp+4f : 0x0p+0f : inexact-ok underflow errno-erange
+= erfc upward flt-32 0x6.bp+4f : 0x8p-152f : inexact-ok underflow errno-erange-ok
+= erfc downward dbl-64 0x6.bp+4 : 0x0p+0 : inexact-ok underflow errno-erange
+= erfc tonearest dbl-64 0x6.bp+4 : 0x0p+0 : inexact-ok underflow errno-erange
+= erfc towardzero dbl-64 0x6.bp+4 : 0x0p+0 : inexact-ok underflow errno-erange
+= erfc upward dbl-64 0x6.bp+4 : 0x4p-1076 : inexact-ok underflow errno-erange-ok
+= erfc downward ldbl-96-intel 0x6.bp+4L : 0x0p+0L : inexact-ok underflow errno-erange
+= erfc tonearest ldbl-96-intel 0x6.bp+4L : 0x0p+0L : inexact-ok underflow errno-erange
+= erfc towardzero ldbl-96-intel 0x6.bp+4L : 0x0p+0L : inexact-ok underflow errno-erange
+= erfc upward ldbl-96-intel 0x6.bp+4L : 0x8p-16448L : inexact-ok underflow errno-erange-ok
+= erfc downward ldbl-96-m68k 0x6.bp+4L : 0x0p+0L : inexact-ok underflow errno-erange
+= erfc tonearest ldbl-96-m68k 0x6.bp+4L : 0x0p+0L : inexact-ok underflow errno-erange
+= erfc towardzero ldbl-96-m68k 0x6.bp+4L : 0x0p+0L : inexact-ok underflow errno-erange
+= erfc upward ldbl-96-m68k 0x6.bp+4L : 0x4p-16448L : inexact-ok underflow errno-erange-ok
+= erfc downward ldbl-128 0x6.bp+4L : 0x0p+0L : inexact-ok underflow errno-erange
+= erfc tonearest ldbl-128 0x6.bp+4L : 0x0p+0L : inexact-ok underflow errno-erange
+= erfc towardzero ldbl-128 0x6.bp+4L : 0x0p+0L : inexact-ok underflow errno-erange
+= erfc upward ldbl-128 0x6.bp+4L : 0x4p-16496L : inexact-ok underflow errno-erange-ok
+= erfc downward ldbl-128ibm 0x6.bp+4L : 0x0p+0L : inexact-ok underflow errno-erange
+= erfc tonearest ldbl-128ibm 0x6.bp+4L : 0x0p+0L : inexact-ok underflow errno-erange
+= erfc towardzero ldbl-128ibm 0x6.bp+4L : 0x0p+0L : inexact-ok underflow errno-erange
+= erfc upward ldbl-128ibm 0x6.bp+4L : 0x4p-1076L : inexact-ok underflow errno-erange-ok
+erfc 108
+= erfc downward flt-32 0x6.cp+4f : 0x0p+0f : inexact-ok underflow errno-erange
+= erfc tonearest flt-32 0x6.cp+4f : 0x0p+0f : inexact-ok underflow errno-erange
+= erfc towardzero flt-32 0x6.cp+4f : 0x0p+0f : inexact-ok underflow errno-erange
+= erfc upward flt-32 0x6.cp+4f : 0x8p-152f : inexact-ok underflow errno-erange-ok
+= erfc downward dbl-64 0x6.cp+4 : 0x0p+0 : inexact-ok underflow errno-erange
+= erfc tonearest dbl-64 0x6.cp+4 : 0x0p+0 : inexact-ok underflow errno-erange
+= erfc towardzero dbl-64 0x6.cp+4 : 0x0p+0 : inexact-ok underflow errno-erange
+= erfc upward dbl-64 0x6.cp+4 : 0x4p-1076 : inexact-ok underflow errno-erange-ok
+= erfc downward ldbl-96-intel 0x6.cp+4L : 0x0p+0L : inexact-ok underflow errno-erange
+= erfc tonearest ldbl-96-intel 0x6.cp+4L : 0x0p+0L : inexact-ok underflow errno-erange
+= erfc towardzero ldbl-96-intel 0x6.cp+4L : 0x0p+0L : inexact-ok underflow errno-erange
+= erfc upward ldbl-96-intel 0x6.cp+4L : 0x8p-16448L : inexact-ok underflow errno-erange-ok
+= erfc downward ldbl-96-m68k 0x6.cp+4L : 0x0p+0L : inexact-ok underflow errno-erange
+= erfc tonearest ldbl-96-m68k 0x6.cp+4L : 0x0p+0L : inexact-ok underflow errno-erange
+= erfc towardzero ldbl-96-m68k 0x6.cp+4L : 0x0p+0L : inexact-ok underflow errno-erange
+= erfc upward ldbl-96-m68k 0x6.cp+4L : 0x4p-16448L : inexact-ok underflow errno-erange-ok
+= erfc downward ldbl-128 0x6.cp+4L : 0x0p+0L : inexact-ok underflow errno-erange
+= erfc tonearest ldbl-128 0x6.cp+4L : 0x0p+0L : inexact-ok underflow errno-erange
+= erfc towardzero ldbl-128 0x6.cp+4L : 0x0p+0L : inexact-ok underflow errno-erange
+= erfc upward ldbl-128 0x6.cp+4L : 0x4p-16496L : inexact-ok underflow errno-erange-ok
+= erfc downward ldbl-128ibm 0x6.cp+4L : 0x0p+0L : inexact-ok underflow errno-erange
+= erfc tonearest ldbl-128ibm 0x6.cp+4L : 0x0p+0L : inexact-ok underflow errno-erange
+= erfc towardzero ldbl-128ibm 0x6.cp+4L : 0x0p+0L : inexact-ok underflow errno-erange
+= erfc upward ldbl-128ibm 0x6.cp+4L : 0x4p-1076L : inexact-ok underflow errno-erange-ok
+erfc 1000
+= erfc downward flt-32 0x3.e8p+8f : 0x0p+0f : inexact-ok underflow errno-erange
+= erfc tonearest flt-32 0x3.e8p+8f : 0x0p+0f : inexact-ok underflow errno-erange
+= erfc towardzero flt-32 0x3.e8p+8f : 0x0p+0f : inexact-ok underflow errno-erange
+= erfc upward flt-32 0x3.e8p+8f : 0x8p-152f : inexact-ok underflow errno-erange-ok
+= erfc downward dbl-64 0x3.e8p+8 : 0x0p+0 : inexact-ok underflow errno-erange
+= erfc tonearest dbl-64 0x3.e8p+8 : 0x0p+0 : inexact-ok underflow errno-erange
+= erfc towardzero dbl-64 0x3.e8p+8 : 0x0p+0 : inexact-ok underflow errno-erange
+= erfc upward dbl-64 0x3.e8p+8 : 0x4p-1076 : inexact-ok underflow errno-erange-ok
+= erfc downward ldbl-96-intel 0x3.e8p+8L : 0x0p+0L : inexact-ok underflow errno-erange
+= erfc tonearest ldbl-96-intel 0x3.e8p+8L : 0x0p+0L : inexact-ok underflow errno-erange
+= erfc towardzero ldbl-96-intel 0x3.e8p+8L : 0x0p+0L : inexact-ok underflow errno-erange
+= erfc upward ldbl-96-intel 0x3.e8p+8L : 0x8p-16448L : inexact-ok underflow errno-erange-ok
+= erfc downward ldbl-96-m68k 0x3.e8p+8L : 0x0p+0L : inexact-ok underflow errno-erange
+= erfc tonearest ldbl-96-m68k 0x3.e8p+8L : 0x0p+0L : inexact-ok underflow errno-erange
+= erfc towardzero ldbl-96-m68k 0x3.e8p+8L : 0x0p+0L : inexact-ok underflow errno-erange
+= erfc upward ldbl-96-m68k 0x3.e8p+8L : 0x4p-16448L : inexact-ok underflow errno-erange-ok
+= erfc downward ldbl-128 0x3.e8p+8L : 0x0p+0L : inexact-ok underflow errno-erange
+= erfc tonearest ldbl-128 0x3.e8p+8L : 0x0p+0L : inexact-ok underflow errno-erange
+= erfc towardzero ldbl-128 0x3.e8p+8L : 0x0p+0L : inexact-ok underflow errno-erange
+= erfc upward ldbl-128 0x3.e8p+8L : 0x4p-16496L : inexact-ok underflow errno-erange-ok
+= erfc downward ldbl-128ibm 0x3.e8p+8L : 0x0p+0L : inexact-ok underflow errno-erange
+= erfc tonearest ldbl-128ibm 0x3.e8p+8L : 0x0p+0L : inexact-ok underflow errno-erange
+= erfc towardzero ldbl-128ibm 0x3.e8p+8L : 0x0p+0L : inexact-ok underflow errno-erange
+= erfc upward ldbl-128ibm 0x3.e8p+8L : 0x4p-1076L : inexact-ok underflow errno-erange-ok
+erfc max
+= erfc downward flt-32 0xf.fffffp+124f : 0x0p+0f : inexact-ok underflow errno-erange
+= erfc tonearest flt-32 0xf.fffffp+124f : 0x0p+0f : inexact-ok underflow errno-erange
+= erfc towardzero flt-32 0xf.fffffp+124f : 0x0p+0f : inexact-ok underflow errno-erange
+= erfc upward flt-32 0xf.fffffp+124f : 0x8p-152f : inexact-ok underflow errno-erange-ok
+= erfc downward dbl-64 0xf.fffffp+124 : 0x0p+0 : inexact-ok underflow errno-erange
+= erfc tonearest dbl-64 0xf.fffffp+124 : 0x0p+0 : inexact-ok underflow errno-erange
+= erfc towardzero dbl-64 0xf.fffffp+124 : 0x0p+0 : inexact-ok underflow errno-erange
+= erfc upward dbl-64 0xf.fffffp+124 : 0x4p-1076 : inexact-ok underflow errno-erange-ok
+= erfc downward ldbl-96-intel 0xf.fffffp+124L : 0x0p+0L : inexact-ok underflow errno-erange
+= erfc tonearest ldbl-96-intel 0xf.fffffp+124L : 0x0p+0L : inexact-ok underflow errno-erange
+= erfc towardzero ldbl-96-intel 0xf.fffffp+124L : 0x0p+0L : inexact-ok underflow errno-erange
+= erfc upward ldbl-96-intel 0xf.fffffp+124L : 0x8p-16448L : inexact-ok underflow errno-erange-ok
+= erfc downward ldbl-96-m68k 0xf.fffffp+124L : 0x0p+0L : inexact-ok underflow errno-erange
+= erfc tonearest ldbl-96-m68k 0xf.fffffp+124L : 0x0p+0L : inexact-ok underflow errno-erange
+= erfc towardzero ldbl-96-m68k 0xf.fffffp+124L : 0x0p+0L : inexact-ok underflow errno-erange
+= erfc upward ldbl-96-m68k 0xf.fffffp+124L : 0x4p-16448L : inexact-ok underflow errno-erange-ok
+= erfc downward ldbl-128 0xf.fffffp+124L : 0x0p+0L : inexact-ok underflow errno-erange
+= erfc tonearest ldbl-128 0xf.fffffp+124L : 0x0p+0L : inexact-ok underflow errno-erange
+= erfc towardzero ldbl-128 0xf.fffffp+124L : 0x0p+0L : inexact-ok underflow errno-erange
+= erfc upward ldbl-128 0xf.fffffp+124L : 0x4p-16496L : inexact-ok underflow errno-erange-ok
+= erfc downward ldbl-128ibm 0xf.fffffp+124L : 0x0p+0L : inexact-ok underflow errno-erange
+= erfc tonearest ldbl-128ibm 0xf.fffffp+124L : 0x0p+0L : inexact-ok underflow errno-erange
+= erfc towardzero ldbl-128ibm 0xf.fffffp+124L : 0x0p+0L : inexact-ok underflow errno-erange
+= erfc upward ldbl-128ibm 0xf.fffffp+124L : 0x4p-1076L : inexact-ok underflow errno-erange-ok
+= erfc downward dbl-64 0xf.ffffffffffff8p+1020 : 0x0p+0 : inexact-ok underflow errno-erange
+= erfc tonearest dbl-64 0xf.ffffffffffff8p+1020 : 0x0p+0 : inexact-ok underflow errno-erange
+= erfc towardzero dbl-64 0xf.ffffffffffff8p+1020 : 0x0p+0 : inexact-ok underflow errno-erange
+= erfc upward dbl-64 0xf.ffffffffffff8p+1020 : 0x4p-1076 : inexact-ok underflow errno-erange-ok
+= erfc downward ldbl-96-intel 0xf.ffffffffffff8p+1020L : 0x0p+0L : inexact-ok underflow errno-erange
+= erfc tonearest ldbl-96-intel 0xf.ffffffffffff8p+1020L : 0x0p+0L : inexact-ok underflow errno-erange
+= erfc towardzero ldbl-96-intel 0xf.ffffffffffff8p+1020L : 0x0p+0L : inexact-ok underflow errno-erange
+= erfc upward ldbl-96-intel 0xf.ffffffffffff8p+1020L : 0x8p-16448L : inexact-ok underflow errno-erange-ok
+= erfc downward ldbl-96-m68k 0xf.ffffffffffff8p+1020L : 0x0p+0L : inexact-ok underflow errno-erange
+= erfc tonearest ldbl-96-m68k 0xf.ffffffffffff8p+1020L : 0x0p+0L : inexact-ok underflow errno-erange
+= erfc towardzero ldbl-96-m68k 0xf.ffffffffffff8p+1020L : 0x0p+0L : inexact-ok underflow errno-erange
+= erfc upward ldbl-96-m68k 0xf.ffffffffffff8p+1020L : 0x4p-16448L : inexact-ok underflow errno-erange-ok
+= erfc downward ldbl-128 0xf.ffffffffffff8p+1020L : 0x0p+0L : inexact-ok underflow errno-erange
+= erfc tonearest ldbl-128 0xf.ffffffffffff8p+1020L : 0x0p+0L : inexact-ok underflow errno-erange
+= erfc towardzero ldbl-128 0xf.ffffffffffff8p+1020L : 0x0p+0L : inexact-ok underflow errno-erange
+= erfc upward ldbl-128 0xf.ffffffffffff8p+1020L : 0x4p-16496L : inexact-ok underflow errno-erange-ok
+= erfc downward ldbl-128ibm 0xf.ffffffffffff8p+1020L : 0x0p+0L : inexact-ok underflow errno-erange
+= erfc tonearest ldbl-128ibm 0xf.ffffffffffff8p+1020L : 0x0p+0L : inexact-ok underflow errno-erange
+= erfc towardzero ldbl-128ibm 0xf.ffffffffffff8p+1020L : 0x0p+0L : inexact-ok underflow errno-erange
+= erfc upward ldbl-128ibm 0xf.ffffffffffff8p+1020L : 0x4p-1076L : inexact-ok underflow errno-erange-ok
+= erfc downward ldbl-96-intel 0xf.fffffffffffffffp+16380L : 0x0p+0L : inexact-ok underflow errno-erange
+= erfc tonearest ldbl-96-intel 0xf.fffffffffffffffp+16380L : 0x0p+0L : inexact-ok underflow errno-erange
+= erfc towardzero ldbl-96-intel 0xf.fffffffffffffffp+16380L : 0x0p+0L : inexact-ok underflow errno-erange
+= erfc upward ldbl-96-intel 0xf.fffffffffffffffp+16380L : 0x8p-16448L : inexact-ok underflow errno-erange-ok
+= erfc downward ldbl-96-m68k 0xf.fffffffffffffffp+16380L : 0x0p+0L : inexact-ok underflow errno-erange
+= erfc tonearest ldbl-96-m68k 0xf.fffffffffffffffp+16380L : 0x0p+0L : inexact-ok underflow errno-erange
+= erfc towardzero ldbl-96-m68k 0xf.fffffffffffffffp+16380L : 0x0p+0L : inexact-ok underflow errno-erange
+= erfc upward ldbl-96-m68k 0xf.fffffffffffffffp+16380L : 0x4p-16448L : inexact-ok underflow errno-erange-ok
+= erfc downward ldbl-128 0xf.fffffffffffffffp+16380L : 0x0p+0L : inexact-ok underflow errno-erange
+= erfc tonearest ldbl-128 0xf.fffffffffffffffp+16380L : 0x0p+0L : inexact-ok underflow errno-erange
+= erfc towardzero ldbl-128 0xf.fffffffffffffffp+16380L : 0x0p+0L : inexact-ok underflow errno-erange
+= erfc upward ldbl-128 0xf.fffffffffffffffp+16380L : 0x4p-16496L : inexact-ok underflow errno-erange-ok
+= erfc downward ldbl-128 0xf.fffffffffffffffffffffffffff8p+16380L : 0x0p+0L : inexact-ok underflow errno-erange
+= erfc tonearest ldbl-128 0xf.fffffffffffffffffffffffffff8p+16380L : 0x0p+0L : inexact-ok underflow errno-erange
+= erfc towardzero ldbl-128 0xf.fffffffffffffffffffffffffff8p+16380L : 0x0p+0L : inexact-ok underflow errno-erange
+= erfc upward ldbl-128 0xf.fffffffffffffffffffffffffff8p+16380L : 0x4p-16496L : inexact-ok underflow errno-erange-ok
+= erfc downward ldbl-128 0xf.ffffffffffffbffffffffffffcp+1020L : 0x0p+0L : inexact-ok underflow errno-erange
+= erfc tonearest ldbl-128 0xf.ffffffffffffbffffffffffffcp+1020L : 0x0p+0L : inexact-ok underflow errno-erange
+= erfc towardzero ldbl-128 0xf.ffffffffffffbffffffffffffcp+1020L : 0x0p+0L : inexact-ok underflow errno-erange
+= erfc upward ldbl-128 0xf.ffffffffffffbffffffffffffcp+1020L : 0x4p-16496L : inexact-ok underflow errno-erange-ok
+= erfc downward ldbl-128ibm 0xf.ffffffffffffbffffffffffffcp+1020L : 0x0p+0L : inexact-ok underflow errno-erange
+= erfc tonearest ldbl-128ibm 0xf.ffffffffffffbffffffffffffcp+1020L : 0x0p+0L : inexact-ok underflow errno-erange
+= erfc towardzero ldbl-128ibm 0xf.ffffffffffffbffffffffffffcp+1020L : 0x0p+0L : inexact-ok underflow errno-erange
+= erfc upward ldbl-128ibm 0xf.ffffffffffffbffffffffffffcp+1020L : 0x4p-1076L : inexact-ok underflow errno-erange-ok
exp 0
= exp downward flt-32 0x0p+0f : 0x1p+0f : inexact-ok
= exp tonearest flt-32 0x0p+0f : 0x1p+0f : inexact-ok
diff --git a/sysdeps/i386/fpu/libm-test-ulps b/sysdeps/i386/fpu/libm-test-ulps
index 0234a61..a492da3 100644
--- a/sysdeps/i386/fpu/libm-test-ulps
+++ b/sysdeps/i386/fpu/libm-test-ulps
@@ -5946,6 +5946,9 @@ double: 1
idouble: 1
ildouble: 1
ldouble: 1
+Test "erfc (0x6.4p+4)":
+ildouble: 1
+ldouble: 1
Test "erfc (0x7.fe8008p+0)":
ildouble: 1
ldouble: 1
diff --git a/sysdeps/ieee754/dbl-64/s_erf.c b/sysdeps/ieee754/dbl-64/s_erf.c
index aab4ed5..3f37397 100644
--- a/sysdeps/ieee754/dbl-64/s_erf.c
+++ b/sysdeps/ieee754/dbl-64/s_erf.c
@@ -112,6 +112,8 @@ static char rcsid[] = "$NetBSD: s_erf.c,v 1.8 1995/05/10 20:47:05 jtc Exp $";
*/
+#include <errno.h>
+#include <float.h>
#include <math.h>
#include <math_private.h>
@@ -391,14 +393,25 @@ __erfc (double x)
r = __ieee754_exp (-z * z - 0.5625) *
__ieee754_exp ((z - x) * (z + x) + R / S);
if (hx > 0)
- return r / x;
+ {
+#if FLT_EVAL_METHOD != 0
+ volatile
+#endif
+ double ret = r / x;
+ if (ret == 0)
+ __set_errno (ERANGE);
+ return ret;
+ }
else
return two - r / x;
}
else
{
if (hx > 0)
- return tiny * tiny;
+ {
+ __set_errno (ERANGE);
+ return tiny * tiny;
+ }
else
return two - tiny;
}
diff --git a/sysdeps/ieee754/flt-32/s_erff.c b/sysdeps/ieee754/flt-32/s_erff.c
index 7d17f42..7c09589 100644
--- a/sysdeps/ieee754/flt-32/s_erff.c
+++ b/sysdeps/ieee754/flt-32/s_erff.c
@@ -17,6 +17,8 @@
static char rcsid[] = "$NetBSD: s_erff.c,v 1.4 1995/05/10 20:47:07 jtc Exp $";
#endif
+#include <errno.h>
+#include <float.h>
#include <math.h>
#include <math_private.h>
@@ -203,9 +205,22 @@ float __erfcf(float x)
SET_FLOAT_WORD(z,ix&0xffffe000);
r = __ieee754_expf(-z*z-(float)0.5625)*
__ieee754_expf((z-x)*(z+x)+R/S);
- if(hx>0) return r/x; else return two-r/x;
+ if(hx>0) {
+#if FLT_EVAL_METHOD != 0
+ volatile
+#endif
+ float ret = r/x;
+ if (ret == 0)
+ __set_errno (ERANGE);
+ return ret;
+ } else
+ return two-r/x;
} else {
- if(hx>0) return tiny*tiny; else return two-tiny;
+ if(hx>0) {
+ __set_errno (ERANGE);
+ return tiny*tiny;
+ } else
+ return two-tiny;
}
}
weak_alias (__erfcf, erfcf)
diff --git a/sysdeps/ieee754/ldbl-128/s_erfl.c b/sysdeps/ieee754/ldbl-128/s_erfl.c
index d9d4195..ef65ed8 100644
--- a/sysdeps/ieee754/ldbl-128/s_erfl.c
+++ b/sysdeps/ieee754/ldbl-128/s_erfl.c
@@ -96,6 +96,7 @@
* erfc/erf(NaN) is NaN
*/
+#include <errno.h>
#include <math.h>
#include <math_private.h>
@@ -918,14 +919,22 @@ __erfcl (long double x)
r = __ieee754_expl (-z * z - 0.5625) *
__ieee754_expl ((z - x) * (z + x) + p);
if ((sign & 0x80000000) == 0)
- return r / x;
+ {
+ long double ret = r / x;
+ if (ret == 0)
+ __set_errno (ERANGE);
+ return ret;
+ }
else
return two - r / x;
}
else
{
if ((sign & 0x80000000) == 0)
- return tiny * tiny;
+ {
+ __set_errno (ERANGE);
+ return tiny * tiny;
+ }
else
return two - tiny;
}
diff --git a/sysdeps/ieee754/ldbl-128ibm/s_erfl.c b/sysdeps/ieee754/ldbl-128ibm/s_erfl.c
index c861c65..95dc415 100644
--- a/sysdeps/ieee754/ldbl-128ibm/s_erfl.c
+++ b/sysdeps/ieee754/ldbl-128ibm/s_erfl.c
@@ -101,6 +101,7 @@
* erfc/erf(NaN) is NaN
*/
+#include <errno.h>
#include <math.h>
#include <math_private.h>
#include <math_ldbl_opt.h>
@@ -940,14 +941,22 @@ __erfcl (long double x)
r = __ieee754_expl (-z * z - 0.5625) *
__ieee754_expl ((z - x) * (z + x) + p);
if ((hx & 0x80000000) == 0)
- return r / x;
+ {
+ long double ret = r / x;
+ if (ret == 0)
+ __set_errno (ERANGE);
+ return ret;
+ }
else
return two - r / x;
}
else
{
if ((hx & 0x80000000) == 0)
- return tiny * tiny;
+ {
+ __set_errno (ERANGE);
+ return tiny * tiny;
+ }
else
return two - tiny;
}
diff --git a/sysdeps/ieee754/ldbl-96/s_erfl.c b/sysdeps/ieee754/ldbl-96/s_erfl.c
index 17d2278..47e4b9e 100644
--- a/sysdeps/ieee754/ldbl-96/s_erfl.c
+++ b/sysdeps/ieee754/ldbl-96/s_erfl.c
@@ -104,6 +104,7 @@
*/
+#include <errno.h>
#include <math.h>
#include <math_private.h>
@@ -422,14 +423,22 @@ __erfcl (long double x)
r = __ieee754_expl (-z * z - 0.5625) *
__ieee754_expl ((z - x) * (z + x) + R / S);
if ((se & 0x8000) == 0)
- return r / x;
+ {
+ long double ret = r / x;
+ if (ret == 0)
+ __set_errno (ERANGE);
+ return ret;
+ }
else
return two - r / x;
}
else
{
if ((se & 0x8000) == 0)
- return tiny * tiny;
+ {
+ __set_errno (ERANGE);
+ return tiny * tiny;
+ }
else
return two - tiny;
}
diff --git a/sysdeps/x86_64/fpu/libm-test-ulps b/sysdeps/x86_64/fpu/libm-test-ulps
index 209fd49..5c923e6 100644
--- a/sysdeps/x86_64/fpu/libm-test-ulps
+++ b/sysdeps/x86_64/fpu/libm-test-ulps
@@ -6776,6 +6776,9 @@ double: 1
idouble: 1
ildouble: 1
ldouble: 1
+Test "erfc (0x6.4p+4)":
+ildouble: 1
+ldouble: 1
Test "erfc (0x7.fe8008p+0)":
float: 1
ifloat: 1
--
Joseph S. Myers
joseph@codesourcery.com