Ignore specific atan2 and sin tests on i586
There seems to be a case of unsoundness with the `i586` version of
`atan2`. For the following test:
assert_eq!(atan2(2.0, -1.0), atan(2.0 / -1.0) + PI);atan2(2.0, -1.0)
The output is optimization-dependent. The new `release-checked` profile
produces the following failure:
thread 'math::atan2::sanity_check' panicked at src/math/atan2.rs:123:5:
assertion `left == right` failed
left: 2.0344439357957027
right: 2.0344439357957027
Similarly, `sin::test_near_pi` fails with the following:
thread 'math::sin::test_near_pi' panicked at src/math/sin.rs:91:5:
assertion `left == right` failed
left: 6.273720864039203e-7
right: 6.273720864039205e-7
Mark the tests ignored on `i586` for now.
This commit is contained in:
parent
f0b932e723
commit
90c76ad3cb
2 changed files with 25 additions and 16 deletions
|
|
@ -114,12 +114,18 @@ pub fn atan2(y: f64, x: f64) -> f64 {
|
|||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn sanity_check() {
|
||||
assert_eq!(atan2(0.0, 1.0), 0.0);
|
||||
assert_eq!(atan2(0.0, -1.0), PI);
|
||||
assert_eq!(atan2(-0.0, -1.0), -PI);
|
||||
assert_eq!(atan2(3.0, 2.0), atan(3.0 / 2.0));
|
||||
assert_eq!(atan2(2.0, -1.0), atan(2.0 / -1.0) + PI);
|
||||
assert_eq!(atan2(-2.0, -1.0), atan(-2.0 / -1.0) - PI);
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
|
||||
#[test]
|
||||
#[cfg_attr(x86_no_sse, ignore = "FIXME(i586): possible incorrect rounding")]
|
||||
fn sanity_check() {
|
||||
assert_eq!(atan2(0.0, 1.0), 0.0);
|
||||
assert_eq!(atan2(0.0, -1.0), PI);
|
||||
assert_eq!(atan2(-0.0, -1.0), -PI);
|
||||
assert_eq!(atan2(3.0, 2.0), atan(3.0 / 2.0));
|
||||
assert_eq!(atan2(2.0, -1.0), atan(2.0 / -1.0) + PI);
|
||||
assert_eq!(atan2(-2.0, -1.0), atan(-2.0 / -1.0) - PI);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -81,12 +81,15 @@ pub fn sin(x: f64) -> f64 {
|
|||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_near_pi() {
|
||||
let x = f64::from_bits(0x400921fb000FD5DD); // 3.141592026217707
|
||||
let sx = f64::from_bits(0x3ea50d15ced1a4a2); // 6.273720864039205e-7
|
||||
let result = sin(x);
|
||||
#[cfg(all(target_arch = "x86", not(target_feature = "sse2")))]
|
||||
let result = force_eval!(result);
|
||||
assert_eq!(result, sx);
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
|
||||
#[test]
|
||||
#[cfg_attr(x86_no_sse, ignore = "FIXME(i586): possible incorrect rounding")]
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue