diff options
| author | bjorn3 <bjorn3@users.noreply.github.com> | 2022-03-25 19:17:19 +0100 |
|---|---|---|
| committer | bjorn3 <bjorn3@users.noreply.github.com> | 2022-03-25 19:32:14 +0100 |
| commit | f3d97cce279fd2372aafec3761791b4110d70bf5 (patch) | |
| tree | 00101f6e59b07d1b0d8605b5123ece3c82b2da60 /example | |
| parent | e336e1bccf3831097283469243b0228accea85d4 (diff) | |
| download | rust-f3d97cce279fd2372aafec3761791b4110d70bf5.tar.gz rust-f3d97cce279fd2372aafec3761791b4110d70bf5.zip | |
Fix saturating float casts test
Fixes #737
Diffstat (limited to 'example')
| -rw-r--r-- | example/std_example.rs | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/example/std_example.rs b/example/std_example.rs index 5bc51a541b5..0a2bce2621d 100644 --- a/example/std_example.rs +++ b/example/std_example.rs @@ -1,7 +1,8 @@ -#![feature(core_intrinsics, generators, generator_trait, is_sorted)] +#![feature(core_intrinsics, generators, generator_trait, is_sorted, bench_black_box)] #[cfg(target_arch = "x86_64")] use std::arch::x86_64::*; +use std::hint::black_box; use std::io::Write; use std::ops::Generator; @@ -86,6 +87,9 @@ fn main() { assert_eq!(houndred_f64 as i128, 100); assert_eq!(1u128.rotate_left(2), 4); + assert_eq!(black_box(f32::NAN) as i128, 0); + assert_eq!(black_box(f32::NAN) as u128, 0); + // Test signed 128bit comparing let max = usize::MAX as i128; if 100i128 < 0i128 || 100i128 > max { |
