Przeglądaj źródła

math: fix x86 asin accuracy
use (1-x)*(1+x) instead of (1-x*x) in asin.s
the later can be inaccurate with upward rounding when x is close to 1

nsz 13 lat temu
rodzic
commit
37eaec3ad3
2 zmienionych plików z 6 dodań i 5 usunięć
  1. 3 2
      src/math/i386/asin.s
  2. 3 3
      src/math/x86_64/asinl.s

+ 3 - 2
src/math/i386/asin.s

@@ -15,9 +15,10 @@ asinl:
 asin:
 	fldl 4(%esp)
 1:	fld %st(0)
-	fmul %st(0)
 	fld1
-	fsubp %st(1)
+	fsub %st(0),%st(1)
+	fadd %st(2)
+	fmulp
 	fsqrt
 	fpatan
 	ret

+ 3 - 3
src/math/x86_64/asinl.s

@@ -3,10 +3,10 @@
 asinl:
 	fldt 8(%rsp)
 1:	fld %st(0)
-	fmul %st(0)
 	fld1
-	fsubp %st(1)
+	fsub %st(0),%st(1)
+	fadd %st(2)
+	fmulp
 	fsqrt
 	fpatan
 	ret
-