From 804fbf0b8c00fd4e2f37ef0769a610614d06138f Mon Sep 17 00:00:00 2001
From: Rich Felker <dalias@aerifal.cx>
Date: Mon, 19 Mar 2012 23:08:49 -0400
Subject: [PATCH] use alternate formula for acos asm to avoid loss of precision

---
 src/math/i386/acos.s | 14 +++++++++++---
 1 file changed, 11 insertions(+), 3 deletions(-)

diff --git a/src/math/i386/acos.s b/src/math/i386/acos.s
index 6f9ef7f0..4f0168f6 100644
--- a/src/math/i386/acos.s
+++ b/src/math/i386/acos.s
@@ -14,11 +14,19 @@ acosl:
 .type acos,@function
 acos:
 	fldl 4(%esp)
-1:	fld %st(0)
-	fmul %st(0)
+1:	fld1
+	fld %st(1)
 	fld1
-	fsubp %st(1)
+	fsubp
+	fxch %st(2)
+	faddp
+	fdivp
 	fsqrt
+	fld1
 	fxch %st(1)
 	fpatan
+	fld1
+	fld1
+	faddp
+	fmulp
 	ret
-- 
2.25.1