Correct hex-float parsing

Unblocks #495.
This commit is contained in:
Marc Tiehuis
2018-06-28 20:12:03 +12:00
parent 2fa588e81d
commit 4a35d7eeeb
2 changed files with 17 additions and 2 deletions

View File

@@ -296,6 +296,14 @@ test "quad hex float literal parsing in range" {
const d = 0x1.edcbff8ad76ab5bf46463233214fp-435;
}
test "quad hex float literal parsing accurate" {
const a: f128 = 0x1.1111222233334444555566667777p+0;
// implied 1 is dropped, with an exponent of 0 (0x3fff) after biasing.
const expected: u128 = 0x3fff1111222233334444555566667777;
assert(@bitCast(u128, a) == expected);
}
test "hex float literal within range" {
const a = 0x1.0p16383;
const b = 0x0.1p16387;