-
Notifications
You must be signed in to change notification settings - Fork 12.7k
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
f32/64::asinh() should return -0.0 for -0.0 #63271
Comments
IEEE-754 (2008), section 9.2.1:
and
|
I don't think adding a fast case for -0.0 is enough, codes like println!("{}", (-1e-20f64).asinh().is_sign_negative()); also reports to be |
Fixed floating point issue with asinh function This should fixes rust-lang#63271 , in which `asinh(-0.0)` returns `0.0` instead of `-0.0`. according to @nagisa > > > IEEE-754 (2008), section 9.2.1: > > > For the functions expm1, exp2m1, exp10m1, logp1, log2p1, log10p1, sin, tan, sinPi, atanPi, asin, atan, sinh, tanh, asinh, and atanh, f(+0) is +0 and f(−0) is −0 with no exception. > > and > > > sinh(±∞) and asinh(±∞) are ±∞ with no exception. After ensuring that the function `asinh` is the only function affected (functions like `sin`, `sinh` are all based on `cmath` library or `llvm` intrinsics), and that `atanh` always gives the correct result. The only function to modify is `asinh`.
Currently, both of the following return false:
However, in other languages like C,
asinh(-0.0)
would always return-0.0
. We might need another fast case for 0.0 and -0.0 here:rust/src/libstd/f64.rs
Lines 833 to 839 in f01b9f8
The text was updated successfully, but these errors were encountered: