From 34e16df5a1a46e128edb9eb44a09ac5762957136 Mon Sep 17 00:00:00 2001 From: Joseph Myers Date: Tue, 3 Dec 2013 16:25:18 +0000 Subject: Fix erfc errno setting on underflow (bug 6786). --- sysdeps/ieee754/ldbl-128ibm/s_erfl.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'sysdeps/ieee754/ldbl-128ibm/s_erfl.c') 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 #include #include #include @@ -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; } -- cgit v1.1