libraries/math.nv
rules
A plus B
lua
f('result', {A + B})
ruby
f 'result', [a.to_f + b.to_f]
A minus B
lua
f('result', {A - B})
ruby
f 'result', [a.to_f - b.to_f]
A times B
lua
f('result', {A * B})
ruby
f 'result', [a.to_f * b.to_f]
A divided by B
lua
f('result', {A / B})
ruby
f 'result', [a.to_f / b.to_f]
A mod B
lua
f('result', {A % B})
ruby
f 'result', [a.to_f % b.to_f]
max of A and B
lua
f('result', {math.max(A, B)})
min of A and B
lua
f('result', {math.min(A, B)})
sine A
lua
f('result', {math.sin(A)})
ruby
f 'result', [Math.sin(a.to_f)]
cosine A
lua
f('result', {math.cos(A)})
ruby
f 'result', [Math.cos(a.to_f)]
absolute value of A
lua
f('result', {math.abs(A)})
floor of A
lua
f('result', {math.floor(A)})
ceiling of A
lua
f('result', {math.ceil(A)})
get pi
lua
f('result', {math.pi})
get tau
lua
f('result', {math.pi * 2})
random number from Min to Max
lua
f('result', {math.random(Min, Max)})
ruby
f 'result', [rand(min.to_f..max.to_f)]
distance between X1 Y1 and X2 Y2
lua
local dx = X1 - X2
local dy = Y1 - Y2
f('result', {math.sqrt(dx * dx + dy * dy)})
angle between X1 Y1 and X2 Y2
lua
f('result', {math.deg(math.atan2(Y2 - Y1, X2 - X1)) + 180})