-
Notifications
You must be signed in to change notification settings - Fork 13.3k
Arc-hyperbolic-trigonometric functions are very inaccurate #104548
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
The issue was originally discovered by @finnbear in FPBench/FPBench#118. I'm testing solutions that don't rely on |
In the two PRs above the following implementations are proposed:
I'll file a PR once I get time to figure out how to download + build + test Rust, probably this or next week. |
Looks like #104553 beat me to it 😃 |
The functions
asinh
andacosh
for bothf32
andf64
are quite inaccurate, both for very large inputs (becausex * x
overflows) and, forasinh
, for very small inputs (due to kinda-complex cancellation).I tried this code:
This code evaluates
asinh(sinh(x))
andacosh(cosh(x))
. Naturally I expected the output to bex
, but instead the output isinf
and0
, indicating overflow and cancellation.Meta
I ran this in the Rust Playground on both Stable (1.65.0) and Nightly (
2022-11-16 e9493d63c2a57b91556d
).The text was updated successfully, but these errors were encountered: