about summary refs log tree commit diff
path: root/sysdeps
diff options
context:
space:
mode:
authorJoseph Myers <joseph@codesourcery.com>2012-03-01 21:15:38 +0000
committerJoseph Myers <joseph@codesourcery.com>2012-03-01 21:15:38 +0000
commit7b1902cb3e64d340247638a8781770c3a4d850ce (patch)
treedc06e102ffa43897515baa0d67cbb944b7a45d77 /sysdeps
parentf775c276fd1f89cc9d561db0890a356e7d6e50b8 (diff)
downloadglibc-7b1902cb3e64d340247638a8781770c3a4d850ce.tar.gz
glibc-7b1902cb3e64d340247638a8781770c3a4d850ce.tar.xz
glibc-7b1902cb3e64d340247638a8781770c3a4d850ce.zip
Improve erfc accuracy.
Diffstat (limited to 'sysdeps')
-rw-r--r--sysdeps/i386/fpu/libm-test-ulps11
-rw-r--r--sysdeps/ieee754/flt-32/s_erff.c2
-rw-r--r--sysdeps/ieee754/ldbl-128ibm/s_erfl.c3
-rw-r--r--sysdeps/powerpc/fpu/libm-test-ulps9
-rw-r--r--sysdeps/x86_64/fpu/libm-test-ulps12
5 files changed, 35 insertions, 2 deletions
diff --git a/sysdeps/i386/fpu/libm-test-ulps b/sysdeps/i386/fpu/libm-test-ulps
index 18097a51c6..56293973dd 100644
--- a/sysdeps/i386/fpu/libm-test-ulps
+++ b/sysdeps/i386/fpu/libm-test-ulps
@@ -422,6 +422,17 @@ idouble: 1
 Test "erfc (0.75) == 0.288844366346484868401062165408589223":
 float: 1
 ifloat: 1
+Test "erfc (0x1.f7303cp+1) == 2.705500297238986897105236321218861842255e-8":
+double: 1
+idouble: 1
+ildouble: 1
+ldouble: 1
+Test "erfc (0x1.ffa002p+2) == 1.233585992097580296336099501489175967033e-29":
+ildouble: 1
+ldouble: 1
+Test "erfc (0x1.ffffc8p+2) == 1.122671365033056305522366683719541099329e-29":
+double: 1
+idouble: 1
 Test "erfc (1.25) == 0.0770998717435417698634765188027188596":
 ildouble: 1
 ldouble: 1
diff --git a/sysdeps/ieee754/flt-32/s_erff.c b/sysdeps/ieee754/flt-32/s_erff.c
index 576618309b..8a0610d5c5 100644
--- a/sysdeps/ieee754/flt-32/s_erff.c
+++ b/sysdeps/ieee754/flt-32/s_erff.c
@@ -200,7 +200,7 @@ float __erfcf(float x)
 				sb5+s*(sb6+s*sb7))))));
 	    }
 	    GET_FLOAT_WORD(ix,x);
-	    SET_FLOAT_WORD(z,ix&0xfffff000);
+	    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;
diff --git a/sysdeps/ieee754/ldbl-128ibm/s_erfl.c b/sysdeps/ieee754/ldbl-128ibm/s_erfl.c
index 85cdbe0ff8..8868f7e1cf 100644
--- a/sysdeps/ieee754/ldbl-128ibm/s_erfl.c
+++ b/sysdeps/ieee754/ldbl-128ibm/s_erfl.c
@@ -920,7 +920,8 @@ __erfcl (long double x)
 	}
       u.value = x;
       u.parts32.w3 = 0;
-      u.parts32.w2 &= 0xffffe000;
+      u.parts32.w2 = 0;
+      u.parts32.w1 &= 0xf8000000;
       z = u.value;
       r = __ieee754_expl (-z * z - 0.5625) *
 	__ieee754_expl ((z - x) * (z + x) + p);
diff --git a/sysdeps/powerpc/fpu/libm-test-ulps b/sysdeps/powerpc/fpu/libm-test-ulps
index 589bae1227..00e994ce7a 100644
--- a/sysdeps/powerpc/fpu/libm-test-ulps
+++ b/sysdeps/powerpc/fpu/libm-test-ulps
@@ -422,6 +422,15 @@ idouble: 1
 Test "erfc (0.75) == 0.288844366346484868401062165408589223":
 float: 1
 ifloat: 1
+Test "erfc (0x1.f7303cp+1) == 2.705500297238986897105236321218861842255e-8":
+double: 1
+idouble: 1
+Test "erfc (0x1.ffa002p+2) == 1.233585992097580296336099501489175967033e-29":
+float: 1
+ifloat: 1
+Test "erfc (0x1.ffff56789abcdef0123456789a8p+2) == 1.123161416304655390092138725253789378459e-29":
+ildouble: 1
+ldouble: 1
 Test "erfc (2.0) == 0.00467773498104726583793074363274707139":
 double: 1
 idouble: 1
diff --git a/sysdeps/x86_64/fpu/libm-test-ulps b/sysdeps/x86_64/fpu/libm-test-ulps
index eb67e91b97..dac90babad 100644
--- a/sysdeps/x86_64/fpu/libm-test-ulps
+++ b/sysdeps/x86_64/fpu/libm-test-ulps
@@ -467,6 +467,16 @@ double: 1
 idouble: 1
 
 # erfc
+Test "erfc (0x1.f7303cp+1) == 2.705500297238986897105236321218861842255e-8":
+double: 1
+idouble: 1
+ildouble: 1
+ldouble: 1
+Test "erfc (0x1.ffa002p+2) == 1.233585992097580296336099501489175967033e-29":
+float: 1
+ifloat: 1
+ildouble: 1
+ldouble: 1
 Test "erfc (1.25) == 0.0770998717435417698634765188027188596":
 ildouble: 1
 ldouble: 1
@@ -1251,7 +1261,9 @@ idouble: 1
 
 Function: "erfc":
 double: 1
+float: 1
 idouble: 1
+ifloat: 1
 ildouble: 1
 ldouble: 1