round to storage format in some tests before comparison to prevent spurious errors on x87.

This commit is contained in:
Peter Michael Green 2021-12-22 00:21:25 +00:00
parent e95ea2b11d
commit e3c3304557
3 changed files with 9 additions and 2 deletions

View file

@ -218,7 +218,10 @@ mod tests {
-0.00000000000000022204460492503126,
);
assert_eq!(fma(-0.992, -0.992, -0.992), -0.007936000000000007,);
let result = fma(-0.992, -0.992, -0.992);
//force rounding to storage format on x87 to prevent superious errors.
#[cfg(all(target_arch = "x86", not(target_feature = "sse2")))]force_eval!(result);
assert_eq!(result, -0.007936000000000007,);
}
#[test]

View file

@ -484,6 +484,8 @@ mod tests {
let exp = expected(*val);
let res = computed(*val);
#[cfg(all(target_arch = "x86", not(target_feature = "sse2")))]force_eval!(exp);
#[cfg(all(target_arch = "x86", not(target_feature = "sse2")))]force_eval!(res);
assert!(
if exp.is_nan() {
res.is_nan()

View file

@ -81,5 +81,7 @@ pub fn sin(x: f64) -> f64 {
fn test_near_pi() {
let x = f64::from_bits(0x400921fb000FD5DD); // 3.141592026217707
let sx = f64::from_bits(0x3ea50d15ced1a4a2); // 6.273720864039205e-7
assert_eq!(sin(x), sx);
let result = sin(x);
#[cfg(all(target_arch = "x86", not(target_feature = "sse2")))]force_eval!(result);
assert_eq!(result, sx);
}