about summary refs log tree commit diff
path: root/sysdeps/i386/fpu/e_acos.S
diff options
context:
space:
mode:
authorJoseph Myers <joseph@codesourcery.com>2012-04-30 18:56:39 +0000
committerJoseph Myers <joseph@codesourcery.com>2012-04-30 18:56:39 +0000
commitadfbc8ac9e192b6e3007f7a47852df937afa2145 (patch)
tree09a345d547258a55e1d410065f9ca09a1bed480c /sysdeps/i386/fpu/e_acos.S
parent5ba3cc691c856e5c67a7d4cd4713f20a79f7ba81 (diff)
downloadglibc-adfbc8ac9e192b6e3007f7a47852df937afa2145.tar.gz
glibc-adfbc8ac9e192b6e3007f7a47852df937afa2145.tar.xz
glibc-adfbc8ac9e192b6e3007f7a47852df937afa2145.zip
Fix x86 acos near 1 (bug 13942).
Diffstat (limited to 'sysdeps/i386/fpu/e_acos.S')
-rw-r--r--sysdeps/i386/fpu/e_acos.S10
1 files changed, 6 insertions, 4 deletions
diff --git a/sysdeps/i386/fpu/e_acos.S b/sysdeps/i386/fpu/e_acos.S
index d10a054b9c..586c7fc406 100644
--- a/sysdeps/i386/fpu/e_acos.S
+++ b/sysdeps/i386/fpu/e_acos.S
@@ -7,13 +7,15 @@
 
 RCSID("$NetBSD: e_acos.S,v 1.4 1995/05/08 23:44:37 jtc Exp $")
 
-/* acos = atan (sqrt(1 - x^2) / x) */
+/* acos = atan (sqrt((1-x) (1+x)) / x) */
 ENTRY(__ieee754_acos)
 	fldl	4(%esp)			/* x */
 	fld	%st			/* x : x */
-	fmul	%st(0)			/* x^2 : x */
-	fld1				/* 1 : x^2 : x */
-	fsubp				/* 1 - x^2 : x */
+	fld1				/* 1 : x : x */
+	fsubp				/* 1 - x : x */
+	fld1				/* 1 : 1 - x : x */
+	fadd	%st(2)			/* 1 + x : 1 - x : x */
+	fmulp				/* 1 - x^2 : x */
 	fsqrt				/* sqrt (1 - x^2) : x */
 	fabs
 	fxch	%st(1)			/* x : sqrt (1 - x^2) */