6 use std::f64::{NAN, NEG_INFINITY, INFINITY, MAX};
10 // Ensure the const-eval result and runtime result of float comparison are equivalent.
12 macro_rules! compare {
15 [NEG_INFINITY, -MAX, -1.0, -0.0, 0.0, 1.0, MAX, INFINITY, NAN],
19 ([$($lhs:expr),+], $op:tt) => {
23 [NEG_INFINITY, -MAX, -1.0, -0.0, 0.0, 1.0, MAX, INFINITY, NAN]
26 ($lhs:expr, $op:tt, [$($rhs:expr),+]) => {
28 // Wrap the check in its own function to reduce time needed to borrowck.
30 static CONST_EVAL: bool = $lhs $op $rhs;
31 let runtime_eval = black_box($lhs) $op black_box($rhs);
32 assert_eq!(CONST_EVAL, runtime_eval, stringify!($lhs $op $rhs));
34 size_of::<[u8; ($lhs $op $rhs) as usize]>(),
35 runtime_eval as usize,
36 stringify!($lhs $op $rhs (forced const eval))
45 assert_eq!(0.0/0.0 < 0.0/0.0, false);
46 assert_eq!(0.0/0.0 > 0.0/0.0, false);
47 assert_eq!(NAN < NAN, false);
48 assert_eq!(NAN > NAN, false);