about summary refs log tree commit diff
path: root/compiler/rustc_codegen_gcc/tests/run/float.rs
blob: df555f383fe0863d1bfd36a17214562f8248018e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
// Compiler:
//
// Run-time:
//   status: 0

fn main() {
    use std::hint::black_box;

    macro_rules! check {
        ($ty:ty, $expr:expr) => {{
            const EXPECTED: $ty = $expr;
            assert_eq!($expr, EXPECTED);
        }};
    }

    check!(i32, black_box(0.0f32) as i32);

    check!(u64, black_box(f32::NAN) as u64);
    check!(u128, black_box(f32::NAN) as u128);

    check!(i64, black_box(f64::NAN) as i64);
    check!(u64, black_box(f64::NAN) as u64);

    check!(i16, black_box(f32::MIN) as i16);
    check!(i16, black_box(f32::MAX) as i16);
}