aboutsummaryrefslogtreecommitdiff
path: root/sysdeps/i386/fpu/e_acosl.c
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_acosl.c
parent5ba3cc691c856e5c67a7d4cd4713f20a79f7ba81 (diff)
downloadglibc-adfbc8ac9e192b6e3007f7a47852df937afa2145.zip
glibc-adfbc8ac9e192b6e3007f7a47852df937afa2145.tar.gz
glibc-adfbc8ac9e192b6e3007f7a47852df937afa2145.tar.bz2
Fix x86 acos near 1 (bug 13942).
Diffstat (limited to 'sysdeps/i386/fpu/e_acosl.c')
-rw-r--r--sysdeps/i386/fpu/e_acosl.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/sysdeps/i386/fpu/e_acosl.c b/sysdeps/i386/fpu/e_acosl.c
index d249d5a..ab08931 100644
--- a/sysdeps/i386/fpu/e_acosl.c
+++ b/sysdeps/i386/fpu/e_acosl.c
@@ -12,11 +12,13 @@ __ieee754_acosl (long double x)
{
long double res;
- /* acosl = atanl (sqrtl(1 - x^2) / x) */
+ /* acosl = atanl (sqrtl((1-x) (1+x)) / x) */
asm ( "fld %%st\n"
- "fmul %%st(0)\n" /* x^2 */
"fld1\n"
- "fsubp\n" /* 1 - x^2 */
+ "fsubp\n"
+ "fld1\n"
+ "fadd %%st(2)\n"
+ "fmulp\n" /* 1 - x^2 */
"fsqrt\n" /* sqrtl (1 - x^2) */
"fabs\n"
"fxch %%st(1)\n"