Use force_eval instead of to_bits/from_bits combination,
Using to_bits/from_bits to force conversion to storage format apparently doesn't work in release mode. Also add an architecture conditional to avoid pessimising other architectures.
This commit is contained in:
parent
17c9073298
commit
874209b56c
1 changed files with 5 additions and 3 deletions
|
|
@ -43,9 +43,11 @@ pub(crate) fn rem_pio2f(x: f32) -> (i32, f64) {
|
|||
if ix < 0x4dc90fdb {
|
||||
/* |x| ~< 2^28*(pi/2), medium size */
|
||||
/* Use a specialized rint() to get fn. Assume round-to-nearest. */
|
||||
// use to_bits and from_bits to force rounding to storage format on
|
||||
// x87.
|
||||
let f_n = f64::from_bits((x64 * INV_PIO2 + TOINT).to_bits()) - TOINT;
|
||||
let tmp = x64 * INV_PIO2 + TOINT;
|
||||
// force rounding of tmp to it's storage format on x87 to avoid
|
||||
// excess precision issues.
|
||||
#[cfg(all(target_arch = "x86", not(target_feature = "sse2")))]force_eval!(tmp);
|
||||
let f_n = tmp - TOINT;
|
||||
return (f_n as i32, x64 - f_n * PIO2_1 - f_n * PIO2_1T);
|
||||
}
|
||||
if ix >= 0x7f800000 {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue