summaryrefslogtreecommitdiff
path: root/lib/std/test
diff options
context:
space:
mode:
authorS. Gilles <sgilles@math.umd.edu>2018-04-19 10:43:14 -0400
committerS. Gilles <sgilles@math.umd.edu>2018-04-19 11:09:29 -0400
commit0f4c2a5b39ba47f84d9b3efda76920fd688defa8 (patch)
tree4a44a36500ce834e1b0ad1c649ef11f966d62b18 /lib/std/test
parent96907bd2e4deb4adbdcb668060a9376b929e9805 (diff)
downloadmc-0f4c2a5b39ba47f84d9b3efda76920fd688defa8.tar.gz
Subnormalize special-case floats in fltXYassem.
If the exponent is the lowest possible representable, then the returned float will actually be subnormal. In this case, we do not have the implied leading 1, so we need to downshift the significand so that it doesn't get lost. We end up losing the least significant bit of the significand, but that's unavoidable.
Diffstat (limited to 'lib/std/test')
-rw-r--r--lib/std/test/fltbits.myr4
1 files changed, 3 insertions, 1 deletions
diff --git a/lib/std/test/fltbits.myr b/lib/std/test/fltbits.myr
index 6493231..c517043 100644
--- a/lib/std/test/fltbits.myr
+++ b/lib/std/test/fltbits.myr
@@ -97,6 +97,7 @@ const flt32bits = {c
(1.0, 0x3f800000),
(0.0000123, 0x374e5c19),
(-993.83, 0xc478751f),
+ (0.000000000000000000000000000000000000006054601, 0x0041edc4),
][:]
var uprime = std.flt32bits(f)
testr.check(c, u == uprime, "flt32bits wrong for {}: 0x{x} != 0x{x}", f, u, uprime)
@@ -116,7 +117,7 @@ const flt64bits = {c
}
const exploderound32 = {c
- for f : [1.0, 0.00001, 123.45, 1111111111111111.2, -1.9, -0.0001, std.flt32nan()][:]
+ for f : [1.0, 0.00001, 123.45, 1111111111111111.2, -1.9, -0.0001, 0.000000000000000000000000000000000000006054601, std.flt32nan()][:]
var n, e, s
(n, e, s) = std.flt32explode(f)
var g = std.flt32assem(n, e, s)
@@ -135,6 +136,7 @@ const exploderound32 = {c
(false, 45, (1 << 23) | 0x23),
(true, -12, (1 << 23) | 0x3a2),
(true, -126, (1 << 23) | 0x3a1),
+ (false, -127, 4320708),
][:]
var m, f, t
(m, f, t) = std.flt32explode(std.flt32assem(n, e, s))