acos.s fix: use the formula acos(x) = atan2(sqrt(1-x),sqrt(1+x))
[musl] / src / math / i386 / acos.s
index 6f9ef7f..bfff0c5 100644 (file)
@@ -14,11 +14,17 @@ 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
+       fsqrt
+       fxch %st(2)
+       faddp
        fsqrt
-       fxch %st(1)
        fpatan
+       fld1
+       fld1
+       faddp
+       fmulp
        ret