Mathematical functions. import math.
Return the smaller of two integers.
math.min(3, 7) // => 3
Return the larger of two integers.
math.max(3, 7) // => 7
Return the absolute value of an integer.
math.abs(-5) // => 5
Raise an integer base to an integer exponent.
math.pow(2, 10) // => 1024
Return the mathematical constant pi (3.14159...).
math.pi() // => 3.141592653589793
Return Euler's number e (2.71828...).
math.e() // => 2.718281828459045
Return the sine of an angle in radians.
math.sin(0.0) // => 0.0
Return the cosine of an angle in radians.
math.cos(0.0) // => 1.0
Return the tangent of an angle in radians.
math.tan(0.0) // => 0.0
Return the natural logarithm (base e) of a float.
math.log(1.0) // => 0.0
Return e raised to the given power.
math.exp(1.0) // => 2.718281828459045
Return the square root of a float.
math.sqrt(16.0) // => 4.0
Return the base-10 logarithm of a float.
math.log10(100.0) // => 2.0
Return the base-2 logarithm of a float.
math.log2(8.0) // => 3.0
Return the sign of an integer: -1, 0, or 1.
math.sign(-42) // => -1
Return the smaller of two floats.
math.fmin(1.5, 2.5) // => 1.5
Return the larger of two floats.
math.fmax(1.5, 2.5) // => 2.5
Raise a float base to a float exponent.
math.fpow(2.0, 0.5) // => 1.4142135623730951
Return the factorial of a non-negative integer.
math.factorial(5) // => 120
Return the binomial coefficient C(n, k) = n! / (k! * (n-k)!).
math.choose(5, 2) // => 10
Return the natural logarithm of the gamma function at x.
math.log_gamma(5.0) // => 3.178...