summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorS. Gilles <sgilles@math.umd.edu>2018-03-12 06:34:25 -0400
committerS. Gilles <sgilles@math.umd.edu>2018-03-12 23:43:42 -0400
commit6fb7d34b848c598e6398f960dc0a7e240e09a6f5 (patch)
treed2b06b9517bae191014f49199e4f230692953336
parent007b768f79b8a45846062086451484a32c1e30fd (diff)
downloadmc-6fb7d34b848c598e6398f960dc0a7e240e09a6f5.tar.gz
Reorder arguments/results of fltXY{explode/assem}
-rw-r--r--lib/std/fltbits.myr16
-rw-r--r--lib/std/fltfmt.myr4
-rw-r--r--lib/std/fltparse.myr4
-rw-r--r--lib/std/test/fltbits.myr32
4 files changed, 28 insertions, 28 deletions
diff --git a/lib/std/fltbits.myr b/lib/std/fltbits.myr
index 0f687ca..509bc06 100644
--- a/lib/std/fltbits.myr
+++ b/lib/std/fltbits.myr
@@ -9,10 +9,10 @@ pkg std =
generic isnan : (f : @a -> bool) ::floating @a
const flt64frombits : (bits : uint64 -> flt64)
const flt32frombits : (bits : uint32 -> flt32)
- const flt64explode : (flt : flt64 -> (bool, uint64, int64))
- const flt32explode : (flt : flt32 -> (bool, uint32, int32))
- const flt64assem : (sign : bool, mant : uint64, exp : int64 -> flt64)
- const flt32assem : (sign : bool, mant : uint32, exp : int32 -> flt32)
+ const flt64explode : (flt : flt64 -> (bool, int64, uint64))
+ const flt32explode : (flt : flt32 -> (bool, int32, uint32))
+ const flt64assem : (sign : bool, exp : int64, mant : uint64 -> flt64)
+ const flt32assem : (sign : bool, exp : int32, mant : uint32 -> flt32)
;;
const flt64bits = {flt; -> (&flt : uint64#)#}
@@ -38,7 +38,7 @@ const flt64explode = {flt
/* adjust for exponent bias */
exp = (uexp : int64) - Dblbias
- -> (isneg, mant, exp)
+ -> (isneg, exp, mant)
}
const flt32explode = {flt
@@ -56,10 +56,10 @@ const flt32explode = {flt
/* adjust for exponent bias */
exp = (uexp : int32) - Fltbias
- -> (isneg, mant, exp)
+ -> (isneg, exp, mant)
}
-const flt64assem = {sign, mant, exp
+const flt64assem = {sign, exp, mant
var s, m, e
s = (sign : uint64)
@@ -68,7 +68,7 @@ const flt64assem = {sign, mant, exp
-> std.flt64frombits((s << 63) | (e << 52) | m)
}
-const flt32assem = {sign, mant, exp
+const flt32assem = {sign, exp, mant
var s, m, e
s = (sign : uint32)
diff --git a/lib/std/fltfmt.myr b/lib/std/fltfmt.myr
index 9988c06..dbe19ce 100644
--- a/lib/std/fltfmt.myr
+++ b/lib/std/fltfmt.myr
@@ -24,7 +24,7 @@ const Fltbias = 127
const flt64bfmt = {sb, val, mode, precision
var isneg, exp, mant
- (isneg, mant, exp) = flt64explode(val)
+ (isneg, exp, mant) = flt64explode(val)
exp = max(exp, 1 - Dblbias)
dragon4(sb, isneg, mant, exp - 52, Dblbias, mode, precision)
}
@@ -32,7 +32,7 @@ const flt64bfmt = {sb, val, mode, precision
const flt32bfmt = {sb, val, mode, precision
var isneg, exp, mant
- (isneg, mant, exp) = flt32explode(val)
+ (isneg, exp, mant) = flt32explode(val)
exp = (max((exp : int64), 1 - Fltbias) : int32)
dragon4(sb, isneg, (mant : uint64), (exp - 23 : int64), Fltbias, mode, precision)
}
diff --git a/lib/std/fltparse.myr b/lib/std/fltparse.myr
index e88eba6..8214f14 100644
--- a/lib/std/fltparse.myr
+++ b/lib/std/fltparse.myr
@@ -264,14 +264,14 @@ const nextfloat = {z, lim
var sign, mant, exp
var za
- (sign, mant, exp) = std.flt64explode(z)
+ (sign, exp, mant) = std.flt64explode(z)
if std.abs((mant : int64) - (1l << 52) - 1) < (lim.nextinc : int64)
mant = 0
exp++
else
mant += lim.nextinc
;;
- za = std.flt64assem(sign, mant, exp)
+ za = std.flt64assem(sign, exp, mant)
-> za
}
diff --git a/lib/std/test/fltbits.myr b/lib/std/test/fltbits.myr
index 1354c70..3907a0f 100644
--- a/lib/std/test/fltbits.myr
+++ b/lib/std/test/fltbits.myr
@@ -112,13 +112,13 @@ const exploderound32 = {c
in order for flt32assem to work as expected
*/
for (n, e, s) : [
- (false, 0, -127),
- (true, 0, -127),
- (false, 0x399, -127),
- (true, 0x23, -127),
- (false, (1 << 23) | 0x23, 45),
- (true, (1 << 23) | 0x3a2, -12),
- (true, (1 << 23) | 0x3a1, -126),
+ (false, -127, 0),
+ (true, -127, 0),
+ (false, -127, 0x399),
+ (true, -127, 0x23),
+ (false, 45, (1 << 23) | 0x23),
+ (true, -12, (1 << 23) | 0x3a2),
+ (true, -126, (1 << 23) | 0x3a1),
][:]
var m, f, t
(m, f, t) = std.flt32explode(std.flt32assem(n, e, s))
@@ -141,15 +141,15 @@ const exploderound64 = {c
in order for flt32assem to work as expected
*/
for (n, e, s) : [
- (false, 0, -1023),
- (true, 0, -1023),
- (false, 0x399, -1023),
- (true, 0x23, -1023),
- (false, (1 << 52) | 0xa33bc, 45),
- (true, (1 << 52) | 0x3, -12),
- (true, (1 << 52) | 0x11aabbcc, -200),
- (true, (1 << 52) | 0x3a1, 543),
- (true, (1 << 52) | 0x99aa228, 1001),
+ (false, -1023, 0),
+ (true, -1023, 0),
+ (false, -1023, 0x399),
+ (true, -1023, 0x23),
+ (false, 45, (1 << 52) | 0xa33bc),
+ (true, -12, (1 << 52) | 0x3),
+ (true, -200, (1 << 52) | 0x11aabbcc),
+ (true, 543, (1 << 52) | 0x3a1),
+ (true, 1001, (1 << 52) | 0x99aa228),
][:]
var m, f, t
(m, f, t) = std.flt64explode(std.flt64assem(n, e, s))