Fix negating f16 and f128 constants

This commit is contained in:
beetrees 2024-04-18 06:43:44 +01:00
parent 5260893724
commit cc12a1b511
No known key found for this signature in database
GPG key ID: 8791BD754191EBD6
2 changed files with 30 additions and 2 deletions

View file

@ -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);
}