Rect::intersection should return None in the presence of NaN.
nical opened this issue · 0 comments
nical commented
For example:
#[test]
fn test_nan() {
let r1: Rect<f32> = rect(-2.0, 5.0, 4.0, std::f32::NAN);
let r2: Rect<f32> = rect(std::f32::NAN, -1.0, 3.0, 10.0);
assert_eq!(r1.intersection(&r2), None);
}
gives
thread 'rect::tests::test_nan' panicked at 'assertion failed: `(left == right)`
left: `Some(Rect(NaNx4.0 at (NaN, 5.0)))`,
right: `None`', src/rect.rs:914:9