-
Notifications
You must be signed in to change notification settings - Fork 13k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rollup merge of #77368 - est31:apfloat_fix, r=varkor
Backport LLVM apfloat commit to rustc_apfloat Backports LLVM commit: llvm/llvm-project@e34bd1e Fixes #69532
- Loading branch information
Showing
3 changed files
with
59 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
// run-pass | ||
#![feature(const_fn_transmute)] | ||
|
||
const fn make_nans() -> (f64, f64, f32, f32) { | ||
let nan1: f64 = unsafe { std::mem::transmute(0x7FF0_0001_0000_0001u64) }; | ||
let nan2: f64 = unsafe { std::mem::transmute(0x7FF0_0000_0000_0001u64) }; | ||
|
||
let nan1_32 = nan1 as f32; | ||
let nan2_32 = nan2 as f32; | ||
|
||
(nan1, nan2, nan1_32, nan2_32) | ||
} | ||
|
||
static NANS: (f64, f64, f32, f32) = make_nans(); | ||
|
||
fn main() { | ||
let (nan1, nan2, nan1_32, nan2_32) = NANS; | ||
|
||
assert!(nan1.is_nan()); | ||
assert!(nan2.is_nan()); | ||
|
||
assert!(nan1_32.is_nan()); | ||
assert!(nan2_32.is_nan()); | ||
} |