about summary refs log tree commit diff
path: root/sysdeps/i386
diff options
context:
space:
mode:
authorJoseph Myers <joseph@codesourcery.com>2012-04-30 09:38:06 +0000
committerJoseph Myers <joseph@codesourcery.com>2012-04-30 09:38:06 +0000
commit5ba3cc691c856e5c67a7d4cd4713f20a79f7ba81 (patch)
tree5dfe27d20ca6c9d2549d2ecd7f2dd565832dc2b0 /sysdeps/i386
parent9568c0c2255045456a09b441f89c6641e27a4bec (diff)
downloadglibc-5ba3cc691c856e5c67a7d4cd4713f20a79f7ba81.tar.gz
glibc-5ba3cc691c856e5c67a7d4cd4713f20a79f7ba81.tar.xz
glibc-5ba3cc691c856e5c67a7d4cd4713f20a79f7ba81.zip
Fix acos (-1) in round-downwards mode on x86 (bug 14034).
Diffstat (limited to 'sysdeps/i386')
-rw-r--r--sysdeps/i386/fpu/e_acos.S1
-rw-r--r--sysdeps/i386/fpu/e_acosf.S1
-rw-r--r--sysdeps/i386/fpu/e_acosl.c1
-rw-r--r--sysdeps/i386/fpu/libm-test-ulps191
4 files changed, 194 insertions, 0 deletions
diff --git a/sysdeps/i386/fpu/e_acos.S b/sysdeps/i386/fpu/e_acos.S
index d3505baf07..d10a054b9c 100644
--- a/sysdeps/i386/fpu/e_acos.S
+++ b/sysdeps/i386/fpu/e_acos.S
@@ -15,6 +15,7 @@ ENTRY(__ieee754_acos)
 	fld1				/* 1 : x^2 : x */
 	fsubp				/* 1 - x^2 : x */
 	fsqrt				/* sqrt (1 - x^2) : x */
+	fabs
 	fxch	%st(1)			/* x : sqrt (1 - x^2) */
 	fpatan				/* atan (sqrt(1 - x^2) / x) */
 	ret
diff --git a/sysdeps/i386/fpu/e_acosf.S b/sysdeps/i386/fpu/e_acosf.S
index 6a843a51dd..54930af8b2 100644
--- a/sysdeps/i386/fpu/e_acosf.S
+++ b/sysdeps/i386/fpu/e_acosf.S
@@ -16,6 +16,7 @@ ENTRY(__ieee754_acosf)
 	fld1
 	fsubp				/* 1 - x^2 */
 	fsqrt				/* sqrt (1 - x^2) */
+	fabs
 	fxch	%st(1)
 	fpatan
 	ret
diff --git a/sysdeps/i386/fpu/e_acosl.c b/sysdeps/i386/fpu/e_acosl.c
index ec516ffca9..d249d5a956 100644
--- a/sysdeps/i386/fpu/e_acosl.c
+++ b/sysdeps/i386/fpu/e_acosl.c
@@ -18,6 +18,7 @@ __ieee754_acosl (long double x)
 	"fld1\n"
 	"fsubp\n"			/* 1 - x^2 */
 	"fsqrt\n"			/* sqrtl (1 - x^2) */
+	"fabs\n"
 	"fxch	%%st(1)\n"
 	"fpatan"
 	: "=t" (res) : "0" (x) : "st(1)");
diff --git a/sysdeps/i386/fpu/libm-test-ulps b/sysdeps/i386/fpu/libm-test-ulps
index c3a3ce0da2..fdaff3525d 100644
--- a/sysdeps/i386/fpu/libm-test-ulps
+++ b/sysdeps/i386/fpu/libm-test-ulps
@@ -5,6 +5,77 @@ Test "acos (0.75) == 0.722734247813415611178377352641333362":
 ildouble: 1
 ldouble: 1
 
+# acos_downward
+Test "acos_downward (-0) == pi/2":
+float: 1
+ifloat: 1
+ildouble: 1
+ldouble: 1
+Test "acos_downward (-0.5) == M_PI_6l*4.0":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+Test "acos_downward (-1) == pi":
+float: 1
+ifloat: 1
+ildouble: 1
+ldouble: 1
+Test "acos_downward (0) == pi/2":
+float: 1
+ifloat: 1
+ildouble: 1
+ldouble: 1
+Test "acos_downward (0.5) == M_PI_6l*2.0":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+
+# acos_towardzero
+Test "acos_towardzero (-0) == pi/2":
+float: 1
+ifloat: 1
+ildouble: 1
+ldouble: 1
+Test "acos_towardzero (-0.5) == M_PI_6l*4.0":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+Test "acos_towardzero (-1) == pi":
+float: 1
+ifloat: 1
+ildouble: 1
+ldouble: 1
+Test "acos_towardzero (0) == pi/2":
+float: 1
+ifloat: 1
+ildouble: 1
+ldouble: 1
+Test "acos_towardzero (0.5) == M_PI_6l*2.0":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+
+# acos_upward
+Test "acos_upward (-0) == pi/2":
+double: 1
+idouble: 1
+Test "acos_upward (-0.5) == M_PI_6l*4.0":
+ildouble: 1
+ldouble: 1
+Test "acos_upward (-1) == pi":
+double: 1
+idouble: 1
+Test "acos_upward (0) == pi/2":
+double: 1
+idouble: 1
+Test "acos_upward (0.5) == M_PI_6l*2.0":
+ildouble: 1
+ldouble: 1
+
 # asin
 Test "asin (-0.5) == -pi/6":
 ildouble: 1
@@ -22,6 +93,76 @@ Test "asin (1.0) == pi/2":
 ildouble: 1
 ldouble: 1
 
+# asin_downward
+Test "asin_downward (-0.5) == -pi/6":
+ildouble: 1
+ldouble: 1
+Test "asin_downward (-1.0) == -pi/2":
+double: 1
+idouble: 1
+ildouble: 1
+ldouble: 1
+Test "asin_downward (0.5) == pi/6":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+ildouble: 1
+ldouble: 1
+Test "asin_downward (1.0) == pi/2":
+float: 1
+ifloat: 1
+
+# asin_tonearest
+Test "asin_tonearest (-0.5) == -pi/6":
+ildouble: 1
+ldouble: 1
+Test "asin_tonearest (0.5) == pi/6":
+ildouble: 1
+ldouble: 1
+
+# asin_towardzero
+Test "asin_towardzero (-0.5) == -pi/6":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+ildouble: 1
+ldouble: 1
+Test "asin_towardzero (-1.0) == -pi/2":
+float: 1
+ifloat: 1
+Test "asin_towardzero (0.5) == pi/6":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+ildouble: 1
+ldouble: 1
+Test "asin_towardzero (1.0) == pi/2":
+float: 1
+ifloat: 1
+
+# asin_upward
+Test "asin_upward (-0.5) == -pi/6":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+ildouble: 1
+ldouble: 1
+Test "asin_upward (-1.0) == -pi/2":
+float: 1
+ifloat: 1
+Test "asin_upward (0.5) == pi/6":
+ildouble: 1
+ldouble: 1
+Test "asin_upward (1.0) == pi/2":
+double: 1
+idouble: 1
+ildouble: 1
+ldouble: 1
+
 # atanh
 Test "atanh (0.75) == 0.972955074527656652552676371721589865":
 ildouble: 2
@@ -2132,10 +2273,60 @@ Function: "acos":
 ildouble: 1
 ldouble: 1
 
+Function: "acos_downward":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+ildouble: 1
+ldouble: 1
+
+Function: "acos_towardzero":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+ildouble: 1
+ldouble: 1
+
+Function: "acos_upward":
+double: 1
+idouble: 1
+ildouble: 1
+ldouble: 1
+
 Function: "asin":
 ildouble: 1
 ldouble: 1
 
+Function: "asin_downward":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+ildouble: 1
+ldouble: 1
+
+Function: "asin_tonearest":
+ildouble: 1
+ldouble: 1
+
+Function: "asin_towardzero":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+ildouble: 1
+ldouble: 1
+
+Function: "asin_upward":
+double: 1
+float: 1
+idouble: 1
+ifloat: 1
+ildouble: 1
+ldouble: 1
+
 Function: "atanh":
 ildouble: 2
 ldouble: 1