tests/pass/frexp.lua

Sat, 21 Sep 2013 14:02:16 +0100

author
Matthew Wild <mwild1@gmail.com>
date
Sat, 21 Sep 2013 14:02:16 +0100
changeset 142
574e0baea136
child 143
a689e0187ef5
permissions
-rw-r--r--

Add math.frexp() and tests (many thanks to Florob and Link Mauve!)

local m, e = math.frexp(1);
assert(m == 0.5 and e == 1, "frexp(1)");

local m, e = math.frexp(0);
assert(m == 0 and e == 0, "frexp(0)");

local m, e = math.frexp(3);
assert(m == 0.75 and e == 2, "frexp(3)");

local m, e = math.frexp(-1);
assert(m == -0.5 and e == 1, "frexp(1)");

mercurial