Math Functions
Version dev
Version:
FunctionDescriptionExampleResultAliases

x!

Factorial of x. Computes the product of the current integer and all integers below it

4!

24

factorial

x ** y

Computes x to the power of y

pow(2, 3)

8.0

pow, power, ^

@x

Absolute value

abs(-17.4)

17.4

abs

acos(x)

Computes the arccosine of x

acos(0.5)

1.0471975511965979

asin(x)

Computes the arcsine of x

asin(0.5)

0.5235987755982989

atan(x)

Computes the arctangent of x

atan(0.5)

0.4636476090008061

atan2(y, x)

Computes the arctangent (y, x)

atan2(1.0, 0.0)

1.5707963267948966

bit_count(x)

Returns the number of bits that are set

bit_count(31)

5

cbrt(x)

Returns the cube root of x

cbrt(8)

2.0

ceil(x)

Rounds the number up

ceil(17.4)

18.0

ceiling

cos(x)

Computes the cos of x

cos(90)

-0.4480736161291701

cot(x)

Computes the cotangent of x

cot(0.5)

1.830487721712452

degrees(x)

Converts radians to degrees

degrees(pi())

180.0

even(x)

Rounds x to next even number by rounding away from zero

even(2.9)

4.0

exp(x)

Computes e to the power of x

exp(1)

2.718281828459045

floor(x)

Rounds the number down

floor(17.4)

17.0

gamma(x)

Interpolation of (x-1) factorial (so decimal inputs are allowed)

gamma(5.5)

52.34277778455352

greatest_common_divisor(x, y)

Computes the greatest common divisor of x and y

greatest_common_divisor(42, 57)

3

gcd

isfinite(x)

Returns true if the floating point value is finite, false otherwise

isfinite(5.5)

true

isinf(x)

Returns true if the floating point value is infinite, false otherwise

isinf('Infinity'::float)

true

isnan(x)

Returns true if the floating point value is not a number, false otherwise

isnan('NaN'::FLOAT)

true

least_common_multiple(x, y)

Computes the least common multiple of x and y

least_common_multiple(42, 57)

798

lcm

lgamma(x)

Computes the log of the gamma function

lgamma(2)

0.0

ln(x)

Computes the natural logarithm of x

ln(2)

0.6931471805599453

log10(x)

Computes the 10-log of x

log10(1000)

3.0

log

log2(x)

Computes the 2-log of x

log2(8)

3.0

nextafter(x, y)

Returns the next floating point value after x in the direction of y

nextafter(1::float, 2::float)

1.0000001192092896

pi()

Returns the value of pi

pi()

3.141592653589793

radians(x)

Converts degrees to radians

radians(90)

1.5707963267948966

round(x, precision)

Rounds x to s decimal places

round(42.4332, 2)

42.43

sign(x)

Returns the sign of x as -1, 0 or 1

sign(-349)

-1

signbit(x)

Returns whether the signbit is set or not

signbit(-0.0)

false

sin(x)

Computes the sin of x

sin(90)

0.8939966636005579

sqrt(x)

Returns the square root of x

sqrt(4)

2.0

tan(x)

Computes the tan of x

tan(90)

-1.995200412208242

trunc(x)

Truncates the number

trunc(17.4)

17.0

Search Shortcut cmd + k | ctrl + k