Overview
These functions all compete math functions, like finding an absolute value, rounding a number, or calculating a hypotenuse.
Math Functions
Percent
.percent(percent, base)
This function returns the percentage of the number (base).
Abs (Absolute Value)
.abs(number)
This function returns the number’s absolute value, which means its distance from zero. It always returns a positive number.
Min
.min(number1, number 2)
This function returns the smaller of the two values.
Max
.max(number1, number 2)
This function returns the larger of the two values.
Pow (Power)
.pow(number1, number2)
This function returns the value of a decimal raised to a given power. Note: the decimal and power can both be any integer or decimal value
Square Root
.squareRoot(number)
This function returns the square root of the given number.
Random
.random(number1, number 2)
This function returns a random number between the two values.
Note: the value can include endpoints
Random Integer
.randomInt(number1, number 2)
This function returns a random integer between the two values.
Note: the value can include endpoints
Round
.round(number)
This function returns the number rounded to the nearest whole number.
Round Up
.roundUp(number)
This function returns the number rounded up to the nearest whole number.
Round Down
.roundDown(number)
This function returns the number rounded down to the nearest whole number.
Round To
.roundTo(number, beforeDecimal, afterDecimal)
This function returns the number rounded to the number of decimal points.
Truncating Remainder
.truncatingRemainder(number, divisor)
This function returns the remainder of the value divided by the divisor using truncating division.
Cos
.cos(number)
This function returns the cosine of a given number.
Sin
.sin(number)
This function returns the sine of a given number.
Tan
.tan(number)
This function returns the tangent of a given number.
Pi
.pi()
This function returns pi.
Hypotenuse
.hypotenuse(length, base)
This function returns the hypotenuse (longest side) of a triangle with a given length and base.
atan2
.atan2(y, x)
This function returns the arctangent of a given number.