9 // Ensure the const-eval result and runtime result of float comparison are equivalent.
11 macro_rules! compare {
14 [f64::NEG_INFINITY, -f64::MAX, -1.0, -0.0, 0.0, 1.0, f64::MAX, f64::INFINITY, f64::NAN],
18 ([$($lhs:expr),+], $op:tt) => {
22 [f64::NEG_INFINITY, -f64::MAX, -1.0, -0.0, 0.0, 1.0, f64::MAX, f64::INFINITY, f64::NAN]
25 ($lhs:expr, $op:tt, [$($rhs:expr),+]) => {
27 // Wrap the check in its own function to reduce time needed to borrowck.
29 static CONST_EVAL: bool = $lhs $op $rhs;
30 let runtime_eval = black_box($lhs) $op black_box($rhs);
31 assert_eq!(CONST_EVAL, runtime_eval, stringify!($lhs $op $rhs));
33 size_of::<[u8; ($lhs $op $rhs) as usize]>(),
34 runtime_eval as usize,
35 stringify!($lhs $op $rhs (forced const eval))
44 assert_eq!(0.0/0.0 < 0.0/0.0, false);
45 assert_eq!(0.0/0.0 > 0.0/0.0, false);
46 assert_eq!(f64::NAN < f64::NAN, false);
47 assert_eq!(f64::NAN > f64::NAN, false);