From 7d43c5e2cb310daede63105ce894b955c545f2e5 Mon Sep 17 00:00:00 2001 From: daurnimator Date: Mon, 22 May 2017 16:33:02 +1000 Subject: tests/test-suite/inprogress/math.js: Move floatbits calculation to prefix --- tests/test-suite/inprogress/math.js | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) (limited to 'tests/test-suite/inprogress') diff --git a/tests/test-suite/inprogress/math.js b/tests/test-suite/inprogress/math.js index ae3ec7a..be58be7 100644 --- a/tests/test-suite/inprogress/math.js +++ b/tests/test-suite/inprogress/math.js @@ -16,6 +16,15 @@ const prefix = ` local intbits = math.floor(math.log(maxint, 2) + 0.5) + 1 --assert((1 << intbits) == 0) + local floatbits = 24 + do + local p = 2.0^floatbits + while p < p + 1.0 do + p = p * 2.0 + floatbits = floatbits + 1 + end + end + local function isNaN (x) return (x ~= x) end @@ -76,16 +85,6 @@ test("[test-suite] math: int bits", function (t) { test("[test-suite] math: number of bits in the mantissa of a floating-point number", function (t) { let luaCode = ` - local floatbits = 24 - do - local p = 2.0^floatbits - while p < p + 1.0 do - p = p * 2.0 - floatbits = floatbits + 1 - end - end - - assert(isNaN(0/0)) assert(not isNaN(1/0)) -- cgit v1.2.3-70-g09d2