Mathematical Functions
All mathematical functions available in AQL.
abs
abs(number)abs(-1) // => 1Description
Returns the absolute value of a number.
Return type
Number
sqrt
sqrt(number)sqrt(9) // => 3
sqrt(10) // => 3.1622776601683795Description
Returns the square root of a number.
Return type
Number
ceil
ceil(number)ceil(1.1) // => 2
ceil(1.9) // => 2Description
Returns the smallest integer greater than or equal to a number.
Return type
Number
floor
floor(number)floor(1.1) // => 1
floor(1.9) // => 1Description
Returns the largest integer less than or equal to a number.
Return type
Number
round
round(number)
round(number, scale)round(1.1) // => 1
round(1.1, 0) // => 1
round(1.9, 0) // => 2
round(1.12345, 2) // => 1.12
round(-1.5) // => -2Description
Returns the rounded value of a number to a specified number of decimal places (scale). Round away from zero if the fractional part of the number is greater than 0.5; otherwise, round towards zero.
Return type
Number
trunc
trunc(number)
trunc(number, scale)trunc(1.1) // => 1
trunc(1.1, 0) // => 1
trunc(1.9, 0) // => 1
trunc(1.12345, 2) // => 1.12Description
Returns the truncated value of a number to a specified number of decimal places (scale).
Return type
Number
exp
exp(number)exp(1) // => 2.718281828459045Description
Returns the value of the constant $e$ raised to the power of a number.
Return type
Number
ln
ln(number)ln(1) // => 0Description
Returns the natural logarithm (log base e) of a number.
Return type
Number
log10
log10(number)log10(100) // => 2Description
Returns the base 10 logarithm (log base 10) of a number.
Return type
Number
log2
log2(number)log2(8) // => 3Description
Returns the base 2 logarithm (log base 2) of a number.
Return type
Number
pow
pow(base, exponent)pow(2, 3) // => 8Description
Returns the value of a base raised to the power of an exponent.
Return type
Number
mod
mod(dividend, divisor)mod(5, 2) // => 1Description
Returns the remainder of a division operation.
Return type
Number
div
div(dividend, divisor)div(5, 2) // => 2Description
Returns the integer quotient of a division operation.
Return type
Number
sign
sign(number)sign(5) // => 1
sign(-5) // => -1
sign(0) // => 0Description
Returns the sign of a number: 1 if the number is positive, -1 if the number is negative, and 0 if the number is zero.
Return type
Number
radians
radians(degrees)radians(180) // => 3.141592653589793Description
Converts degrees to radians.
Return type
Number
degrees
degrees(radians)degrees(pi()) // => 180Description
Converts radians to degrees.
Return type
Number
pi
pi()pi() // => 3.141592653589793Description
Returns the value of the constant π.
Return type
Number
acos
acos(number)acos(cos(pi())) // => 3.141592653589793Description
Returns the arccosine of a number.
Return type
Number
asin
asin(number)asin(sin(pi() / 2)) // => 1.5707963267948966Description
Returns the arcsine of a number.
Return type
Number
atan
atan(number)atan(tan(pi() / 4)) // => 0.7853981633974483Description
Returns the arctangent of a number.
Return type
Number
atan2
atan2(y, x)atan2(2, pi()) // => 0.6366197723675814Description
Returns the 2-argument arctangent.
Return type
Number
cos
cos(number)cos(pi()) // => -1Description
Returns the cosine of a number.
Return type
Number
sin
sin(number)sin(pi() / 2) // => 1Description
Returns the sine of a number.
Return type
Number
tan
tan(number)tan(pi() / 4) // => 1Description
Returns the tangent of a number.
Return type
Number
cot
cot(number)cot(pi() / 4) // => 1Description
Returns the cotangent of a number.
Return type
Number