Math Functions

Overview

These functions perform basic numeric operations on the input number and return a number as the result.

Reference

abs

abs(double x) double

Returns the absolute value of x.

ceil

ceil(double x) long

Returns the smallest integer that is greater than or equal to x.

floor

floor(double x) long

Returns the largest integer that is less than or equal to x.

pow

pow(double x, double y) double

Returns x raised to the power of y.

round

round(double x[, int y]) long

Returns x rounded to y decimal places (precision).

The precision is 0 if omitted.

round(x, 0) rounds the number to the nearest integer.

If y is less than 0, the number is rounded to the left of the decimal point by the indicated number of places.

max

max(double x, double y) double

Returns the greater of two numbers: x and y.

min

min(double x, double y) double

Returns the smallest of two numbers: x and y.

mod

mod(number x, number y) double

Returns the remainder (modulus) of number x divided by number y.

This function provides an alternative to x % y syntax which is not supported.

cbrt

cbrt(double x) double

Returns cube root ∛ of x.

sqrt

sqrt(double x) double

Returns of x.

exp

exp(double x) double

Returns Euler constant e (2.718281828459045) raised to the power of x.

log

log(double x) double

Returns the natural logarithm (base e = 2.718281828459045) of x.

log10

log10(double x) double

Returns the base 10 logarithm of x.

signum

signum(double x) int

Returns the signum function of the argument: 0 if the argument is 0, 1 if the argument is greater than 1, -1 if the argument is less than 0.