2024-02-16 14:02:50 -06:00
|
|
|
//@ check-pass
|
|
|
|
//@ run-rustfix
|
2023-05-20 16:05:09 -05:00
|
|
|
|
|
|
|
fn main() {
|
|
|
|
let x = 5f32;
|
|
|
|
let _ = x.is_nan();
|
|
|
|
//~^ WARN incorrect NaN comparison
|
|
|
|
let _ = !x.is_nan();
|
|
|
|
//~^ WARN incorrect NaN comparison
|
|
|
|
|
|
|
|
let x = 5f64;
|
|
|
|
let _ = x.is_nan();
|
|
|
|
//~^ WARN incorrect NaN comparison
|
|
|
|
let _ = !x.is_nan();
|
|
|
|
//~^ WARN incorrect NaN comparison
|
|
|
|
|
|
|
|
let b = &2.3f32;
|
|
|
|
if !b.is_nan() {}
|
|
|
|
//~^ WARN incorrect NaN comparison
|
|
|
|
|
|
|
|
let b = &2.3f32;
|
|
|
|
if !b.is_nan() {}
|
|
|
|
//~^ WARN incorrect NaN comparison
|
|
|
|
|
|
|
|
let _ =
|
|
|
|
!b.is_nan();
|
|
|
|
|
|
|
|
#[allow(unused_macros)]
|
|
|
|
macro_rules! nan { () => { f32::NAN }; }
|
|
|
|
macro_rules! number { () => { 5f32 }; }
|
|
|
|
|
|
|
|
let _ = number!().is_nan();
|
|
|
|
//~^ WARN incorrect NaN comparison
|
|
|
|
let _ = !number!().is_nan();
|
|
|
|
//~^ WARN incorrect NaN comparison
|
|
|
|
}
|