tests/pass/frexp.lua

1
local m, e = math.frexp(1);
2
assert(m == 0.5 and e == 1, "frexp(1)");
3
 
4
local m, e = math.frexp(0);
5
assert(m == 0 and e == 0, "frexp(0)");
6
 
7
local m, e = math.frexp(3);
8
assert(m == 0.75 and e == 2, "frexp(3)");
9
 
10
local m, e = math.frexp(-1);
11
assert(m == -0.5 and e == 1, "frexp(-1)");
12
 
13
local m, e = math.frexp(0.5);
14
assert(m == 0.5 and e == 0, "frexp(0.5)");
15
 
16
local m, e = math.frexp(0.1);
17
assert(m == 0.8 and e == -3, "frexp(0.1)");