projects
/
oweals
/
musl.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
2e0c1fe
)
acos.s fix: use the formula acos(x) = atan2(sqrt(1-x),sqrt(1+x))
author
nsz
<nsz@port70.net>
Thu, 22 Mar 2012 13:54:47 +0000
(14:54 +0100)
committer
nsz
<nsz@port70.net>
Thu, 22 Mar 2012 13:54:47 +0000
(14:54 +0100)
the old formula atan2(1,sqrt((1+x)/(1-x))) was faster but
could give nan result at x=1 when the rounding mode is
FE_DOWNWARD (so 1-1 == -0 and 2/-0 == -inf), the new formula
gives -0 at x=+-1 with downward rounding.
src/math/i386/acos.s
patch
|
blob
|
history
src/math/x86_64/acosl.s
patch
|
blob
|
history
diff --git
a/src/math/i386/acos.s
b/src/math/i386/acos.s
index 4f0168f623d1f0294324b286ad90e2e9d2c46785..bfff0c5c9a89d3332ea7df6a8e5d3cd0a68a01f3 100644
(file)
--- a/
src/math/i386/acos.s
+++ b/
src/math/i386/acos.s
@@
-18,12
+18,10
@@
acos:
fld %st(1)
fld1
fsubp
+ fsqrt
fxch %st(2)
faddp
- fdivp
fsqrt
- fld1
- fxch %st(1)
fpatan
fld1
fld1
diff --git
a/src/math/x86_64/acosl.s
b/src/math/x86_64/acosl.s
index 92c2987079067f1e3a100db0f0c59c83688d5e8b..db68d2de268cd83498e0ad43bfababdb2790608d 100644
(file)
--- a/
src/math/x86_64/acosl.s
+++ b/
src/math/x86_64/acosl.s
@@
-6,12
+6,10
@@
acosl:
fld %st(1)
fld1
fsubp
+ fsqrt
fxch %st(2)
faddp
- fdivp
fsqrt
- fld1
- fxch %st(1)
fpatan
fld1
fld1