diff options
| author | beetrees <b@beetr.ee> | 2024-04-18 06:43:44 +0100 |
|---|---|---|
| committer | beetrees <b@beetr.ee> | 2024-04-18 06:43:44 +0100 |
| commit | cc12a1b5119b003132a16e83c19642bb6584f2df (patch) | |
| tree | f2a3d17d0b3b176a66a7a7b3a1d85d588a3ae3d0 /tests/ui/numbers-arithmetic | |
| parent | 5260893724057f707fd993dc3a7a050f3fc7be9e (diff) | |
| download | rust-cc12a1b5119b003132a16e83c19642bb6584f2df.tar.gz rust-cc12a1b5119b003132a16e83c19642bb6584f2df.zip | |
Fix negating `f16` and `f128` constants
Diffstat (limited to 'tests/ui/numbers-arithmetic')
| -rw-r--r-- | tests/ui/numbers-arithmetic/f16-f128-lit.rs | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/tests/ui/numbers-arithmetic/f16-f128-lit.rs b/tests/ui/numbers-arithmetic/f16-f128-lit.rs new file mode 100644 index 00000000000..762436edb16 --- /dev/null +++ b/tests/ui/numbers-arithmetic/f16-f128-lit.rs @@ -0,0 +1,16 @@ +//@ run-pass + +#![feature(f16)] +#![feature(f128)] + +fn main() { + assert_eq!(0.0_f16.to_bits(), 0x0000); + assert_eq!((-0.0_f16).to_bits(), 0x8000); + assert_eq!(10.0_f16.to_bits(), 0x4900); + assert_eq!((-10.0_f16).to_bits(), 0xC900); + + assert_eq!(0.0_f128.to_bits(), 0x0000_0000_0000_0000_0000_0000_0000_0000); + assert_eq!((-0.0_f128).to_bits(), 0x8000_0000_0000_0000_0000_0000_0000_0000); + assert_eq!(10.0_f128.to_bits(), 0x4002_4000_0000_0000_0000_0000_0000_0000); + assert_eq!((-10.0_f128).to_bits(), 0xC002_4000_0000_0000_0000_0000_0000_0000); +} |
