[Libre-soc-bugs] [Bug 632] Potentially share Vector Math libraries with Rust's project portable SIMD (`std::simd`)

bugzilla-daemon at libre-soc.org bugzilla-daemon at libre-soc.org
Mon May 10 08:47:11 BST 2021


https://bugs.libre-soc.org/show_bug.cgi?id=632

--- Comment #10 from Jacob Lifshay <programmerjake at gmail.com> ---
>From https://github.com/rust-lang/stdsimd/issues/109#issuecomment-836310527
I added implementations of `sin_pi` and `cos_pi` for `f16` and `f32`, I tested
all possible inputs, the functions are accurate to 2ULP though aren't
guaranteed to give the correct sign for zeros.

Testing the `f32` functions required writing a custom reference implementation
of `sin_cos_pi` since `(x * f64::consts::PI).sin_cos()` isn't accurate enough
when the exact mathematical value of either `sin` or `cos` is close to zero
(e.g. `sin_pi(1.0) == 0.0` but `f64::consts::PI.sin() != 0.0` due to round-off
error).

https://salsa.debian.org/Kazan-team/vector-math/-/blob/d79f43bed2398cbc4f6b75b8e55ee317289599a1/src/algorithms/trig_pi.rs#L180

-- 
You are receiving this mail because:
You are on the CC list for the bug.


More information about the libre-soc-bugs mailing list