You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
ravi/tests/comptests/inputs/19_arith.lua

7 lines
313 B

adder = compiler.load('local a: number, b: number = 1.1, 2.2 return a+b')
assert(adder and type(adder) == 'function')
assert(math.abs(adder() - 3.3) < 1e-15)
mult = compiler.load('local a: number, b: number = 1.1, 2.2 return a*b')
assert(mult and type(mult) == 'function')
assert(math.abs(mult() - 2.42) < 1e-15)