diff options
author | nsz <nsz@port70.net> | 2012-03-22 14:54:47 +0100 |
---|---|---|
committer | nsz <nsz@port70.net> | 2012-03-22 14:54:47 +0100 |
commit | a4a0c91275788407763b1e5a9da17b777495ca85 (patch) | |
tree | 1c4e53cfe0c6b0ab80df621813acb74715e9ab3b /src | |
parent | 2e0c1fed36be1f1435de79bfc7cdc34824cb5614 (diff) | |
download | musl-a4a0c91275788407763b1e5a9da17b777495ca85.tar.gz musl-a4a0c91275788407763b1e5a9da17b777495ca85.tar.bz2 musl-a4a0c91275788407763b1e5a9da17b777495ca85.tar.xz musl-a4a0c91275788407763b1e5a9da17b777495ca85.zip |
acos.s fix: use the formula acos(x) = atan2(sqrt(1-x),sqrt(1+x))
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.
Diffstat (limited to 'src')
-rw-r--r-- | src/math/i386/acos.s | 4 | ||||
-rw-r--r-- | src/math/x86_64/acosl.s | 4 |
2 files changed, 2 insertions, 6 deletions
diff --git a/src/math/i386/acos.s b/src/math/i386/acos.s index 4f0168f6..bfff0c5c 100644 --- 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 92c29870..db68d2de 100644 --- 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 |