summaryrefslogtreecommitdiff
path: root/tests/test-suite/inprogress
diff options
context:
space:
mode:
authordaurnimator <quae@daurnimator.com>2017-05-22 16:33:02 +1000
committerdaurnimator <quae@daurnimator.com>2017-05-22 16:33:02 +1000
commit7d43c5e2cb310daede63105ce894b955c545f2e5 (patch)
tree94aefa944df101bf9bf4ab1e7aa972a37ae4a934 /tests/test-suite/inprogress
parent282eb802af40c8a4a31f1c07abdf958bc6f4d35a (diff)
downloadfengari-7d43c5e2cb310daede63105ce894b955c545f2e5.tar.gz
fengari-7d43c5e2cb310daede63105ce894b955c545f2e5.tar.bz2
fengari-7d43c5e2cb310daede63105ce894b955c545f2e5.zip
tests/test-suite/inprogress/math.js: Move floatbits calculation to prefix
Diffstat (limited to 'tests/test-suite/inprogress')
-rw-r--r--tests/test-suite/inprogress/math.js19
1 files changed, 9 insertions, 10 deletions
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))