Math Library

Math Library

Math functions are namespaced under Math.


import "Math" as Math; # If loaded as package
val = Math.sqrt(16);
    
MethodDescription
Math.sqrt(x)Square root
Math.pow(b, e)Power
Math.abs(x)Absolute value
Math.min(a, b)Minimum of two values
Math.max(a, b)Maximum of two values
Math.floor(x)Floor
Math.ceil(x)Ceiling
Math.sin(rad)Sine of angle in radians
Math.cos(rad)Cosine of angle in radians
Math.tan(rad)Tangent of angle in radians
Math.asin(x)Arc sine
Math.acos(x)Arc cosine
Math.atan(x)Arc tangent
Math.toRadians(deg)Convert degrees to radians
Math.toDegrees(rad)Convert radians to degrees
Math.exp(x)Euler's number e raised to the power of x
Math.log(x)Natural logarithm (base e)
Math.log10(x)Base 10 logarithm
Math.round(x)Rounds to nearest integer
Math.PIConstant PI
Math.EConstant E