Skip to content

Commit a9e8dfb

Browse files
committed
Ignore an atan2 test 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 Mark the test ignored on `i586` for now.
1 parent b1e7ea0 commit a9e8dfb

File tree

1 file changed

+14
-8
lines changed

1 file changed

+14
-8
lines changed

src/math/atan2.rs

+14-8
Original file line numberDiff line numberDiff line change
@@ -114,12 +114,18 @@ pub fn atan2(y: f64, x: f64) -> f64 {
114114
}
115115
}
116116

117-
#[test]
118-
fn sanity_check() {
119-
assert_eq!(atan2(0.0, 1.0), 0.0);
120-
assert_eq!(atan2(0.0, -1.0), PI);
121-
assert_eq!(atan2(-0.0, -1.0), -PI);
122-
assert_eq!(atan2(3.0, 2.0), atan(3.0 / 2.0));
123-
assert_eq!(atan2(2.0, -1.0), atan(2.0 / -1.0) + PI);
124-
assert_eq!(atan2(-2.0, -1.0), atan(-2.0 / -1.0) - PI);
117+
#[cfg(test)]
118+
mod tests {
119+
use super::*;
120+
121+
#[test]
122+
#[cfg_attr(x86_no_sse, ignore = "FIXME(i586): possible incorrect rounding")]
123+
fn sanity_check() {
124+
assert_eq!(atan2(0.0, 1.0), 0.0);
125+
assert_eq!(atan2(0.0, -1.0), PI);
126+
assert_eq!(atan2(-0.0, -1.0), -PI);
127+
assert_eq!(atan2(3.0, 2.0), atan(3.0 / 2.0));
128+
assert_eq!(atan2(2.0, -1.0), atan(2.0 / -1.0) + PI);
129+
assert_eq!(atan2(-2.0, -1.0), atan(-2.0 / -1.0) - PI);
130+
}
125131
}

0 commit comments

Comments
 (0)