use libm for acosh and asinh#154051
Conversation
|
r? @joboet rustbot has assigned @joboet. Use Why was this reviewer chosen?The reviewer was selected based on:
|
|
Hello @malezjaa, |
|
I'm really sorry about that. I should've checked If anyone was already assigned to this issue. I'll do that from now on. |
This comment has been minimized.
This comment has been minimized.
4a67c1e to
90a7256
Compare
|
This PR was rebased onto a different main commit. Here's a range-diff highlighting what actually changed. Rebasing is a normal part of keeping PRs up to date, so no action is needed—this note is just to help reviewers. |
|
Happy to review this or alternatives, unless you have a preference @joboet r? tgross35 |
Can we just call libm via the Can you also clarify what approximations you are referencing? This isn't what is in https://github.com/rust-lang/compiler-builtins/blob/644346f0541f74fc425070f8e0712f2dac898e11/libm/src/math/acosh.rs. |
3a210bb to
538e681
Compare
|
Oh yeah that makes sense. I'll update the PR title and description to show that we're now using libm for these functions. |
This comment has been minimized.
This comment has been minimized.
|
@rustbot author |
|
Reminder, once the PR becomes ready for a review, use |
538e681 to
abd315c
Compare
|
The Miri subtree was changed cc @rust-lang/miri |
This comment has been minimized.
This comment has been minimized.
…asinh, r=tgross35 use libm for acosh and asinh for f16, f32, and f64 Fixes rust-lang#153878 Uses libm for `acosh` and `asinh` for `f16`, `f32`, and `f64`. I didn't change impl for f128 as i couldn't find existing function for these in libm
|
Should I just increase ASINH_APPROX, ACOSH_APPROX thresholds for x86 or is that not the solution? |
|
Ah yeah, i586 has all kinds of issues with floating point accuracy. I would do this as: /// i586 has issues with floating point precision.
const I586: bool = cfg!(target_arch = "x86") && cfg!(not(target_feature = "sse2"));
impl ... {
const ASINH_APPROX: Self = if i586 { /* relaxed precision */ } else { /* current precision */ };
}Make the precision larger than what showed up in the tests to leave some flexibility in the future. |
|
Oh also, is this only for f32 or for other types too? |
|
Usually that applies to f32 and f64 (not f16/f128 since they don't have the same ABI), but I guess the f64 precision is already relaxed enough. |
e83e484 to
a1feab1
Compare
|
@bors try jobs=dist-i586-gnu-i586-i686-musl |
This comment has been minimized.
This comment has been minimized.
use libm for acosh and asinh for f16, f32, and f64 try-job: dist-i586-gnu-i586-i686-musl
|
@bors r+ |
…uwer Rollup of 8 pull requests Successful merges: - #149868 (rustc: Stop passing `--allow-undefined` on wasm targets) - #153555 (Clarified docs in std::sync::RwLock + added test to ensure that max reader count is respected) - #152851 (Fix SGX delayed host lookup via ToSocketAddr) - #154051 (use libm for acosh and asinh) - #154581 (More informative `Debug for vec::ExtractIf`) - #154461 (Edit the docs new_in() and with_capacity_in()) - #154526 (Panic/return false on overflow in no_threads read/try_read impl) - #154798 (rustdoc-search: match path components on words)
|
Thank you for your time with this PR :D |
|
We’re happy to help :) thank you for working on it! |
…uwer Rollup of 8 pull requests Successful merges: - rust-lang/rust#149868 (rustc: Stop passing `--allow-undefined` on wasm targets) - rust-lang/rust#153555 (Clarified docs in std::sync::RwLock + added test to ensure that max reader count is respected) - rust-lang/rust#152851 (Fix SGX delayed host lookup via ToSocketAddr) - rust-lang/rust#154051 (use libm for acosh and asinh) - rust-lang/rust#154581 (More informative `Debug for vec::ExtractIf`) - rust-lang/rust#154461 (Edit the docs new_in() and with_capacity_in()) - rust-lang/rust#154526 (Panic/return false on overflow in no_threads read/try_read impl) - rust-lang/rust#154798 (rustdoc-search: match path components on words)
View all comments
Fixes #153878
Uses libm for
acoshandasinh