forked from ax-jason/luafixmath
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest_fixmath.lua
More file actions
34 lines (30 loc) · 773 Bytes
/
Copy pathtest_fixmath.lua
File metadata and controls
34 lines (30 loc) · 773 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
local fixmath = require("fixmath")
local a=fixmath.tofix("222")
local b = 1
local b = a/10
print(a, a+a, a+fixmath.tofix(49), a+1,b)
print(fixmath.maxvalue, fixmath.minvalue, fixmath.tofix(32769), a:sqrt(),a:tonumber())
local function testmath(name, ...)
local fix = fixmath[name](...)
print(name, fix, math[name] and math[name](...))
end
testmath("abs", -1)
testmath("floor", 1.1)
testmath("ceil",1.1)
testmath("min",1,2)
testmath("max",1,2)
testmath("sin",1)
testmath("cos",1)
testmath("tan",1)
testmath("asin",1.0)
testmath("acos",1.0)
testmath("asin",0)
testmath("acos",0.0)
testmath("atan",1)
testmath("atan2",1,2)
testmath("deg",1)
testmath("rad",90)
testmath("sqrt",2)
testmath("exp",1)
testmath("log",61)
testmath("log",3,4)