about summary refs log tree commit diff
path: root/sysdeps/ieee754/ldbl-96
diff options
context:
space:
mode:
authorJoseph Myers <joseph@codesourcery.com>2013-12-03 16:25:18 +0000
committerJoseph Myers <joseph@codesourcery.com>2013-12-03 16:25:18 +0000
commit34e16df5a1a46e128edb9eb44a09ac5762957136 (patch)
treed8751230a2270d89531af1f7c12868dae50f534f /sysdeps/ieee754/ldbl-96
parentd8e2dbe3e380729a1552d546da582b02202dde0a (diff)
downloadglibc-34e16df5a1a46e128edb9eb44a09ac5762957136.tar.gz
glibc-34e16df5a1a46e128edb9eb44a09ac5762957136.tar.xz
glibc-34e16df5a1a46e128edb9eb44a09ac5762957136.zip
Fix erfc errno setting on underflow (bug 6786).
Diffstat (limited to 'sysdeps/ieee754/ldbl-96')
-rw-r--r--sysdeps/ieee754/ldbl-96/s_erfl.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/sysdeps/ieee754/ldbl-96/s_erfl.c b/sysdeps/ieee754/ldbl-96/s_erfl.c
index 17d2278524..47e4b9e909 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;
     }