Skip to main content

Math functions

This type of function includes math, trigonometric, and logic functions.

As parameters of the function, you can pass numeric scalars, numeric functions, math constants, boolean scalars, boolean functions, or a column name. To pass a column cell, you can use the syntax ${columnName}. Other ways to use parameters: true , false, PI, E etc.

By default, real numbers in a column show only 2 digits after the integer part. You can change this behavior by setting the appropriate format for displaying the data in the column. To do this, click on the column heading and in the opened context menu select "Format" option.

Function List:

Abs(x)

Returns the absolute value of a number [x].

Abs(-10)    // 10

Acos(x)

Returns the arccosine of a number [x] as an angle expressed in radians in the interval 0..PI. x must be in the interval -1..1.

Acos(0.5)    // 1.047197580337524

Add(x, y)

Returns the sum of two numbers x and y.

Add(24.06, 100)    // 124.06

And(a, b)

Returns logical conjunction of boolean a and b.

And(true, false)        // false
And(5 == 5, 10 < 20) // true

Asin(x)

Returns the arcsine of a number x as an angle expressed in radians in the interval -PI/2..PI/2. x must be in the interval -1..1.

Asin(0.5)    // 0.479425549507141

Atan(x)

Returns the arc tangent of a number x as an angle expressed in radians in the interval -PI/2..PI/2.

Atan(1)    // 0.785398185253143

Atan2(x, y)

Returns the angle in radians between the positive X-axis and the vector (y,x). The result is in the range -PI..PI. If y is positive, this is the same as Atan(x / y).

The result is negative when x is negative (including when x is -0.0). If x is equal to zero, the vector (y,x) is considered parallel to the X-axis, even if y is also equal to zero. The sign of y determines the direction of the vector along the X-axis.

Atan2(0, -0)    // 3.141592741012573

Avg([x1, x2, x3...])

Returns the average (arithmetic mean) of the numbers. Arguments are a set of numbers enclosed in square brackets.

Avg([-1, 3.5, 6.5])    // 3
Avg([1, 2, 3, 4]) // 2.5

Ceil(x)

Returns the least integer no smaller than x.

Ceil(3.5)     // 4
Ceil(-3.5) // -3

Cos(x)

Returns the cosine of a number [x].

Cos(0)         // 1
Cos(PI / 3) // 0.5

Div(x, y)

Returns the result of dividing x by y.

Div(7.5, 2)    // 3.75

Eq(x, y)

Returns true if x equal to y and false otherwise.

Eq(5, 5)           // true
Eq(true, false) // false

Exp(x)

Returns the natural exponent (E) to the power x.

Exp(2)    // 7.389056205749512

Fixed(x, decimalPlaces)

Returns the rounded number x to the specified number of decimalPlaces.

Fixed(3.5, 2)   // 3.50
Fixed(-3.5, 0) // -4

Floor(x)

Returns the greatest integer no greater than x.

Floor(3.5)     // 3
Floor(-3.5) // -4

FormatFloat(x, format)

Returns the number x formatted according to the specified format.

FormatFloat(12345.12345, 'scientific')    // 1.23E4
FormatFloat(12345.12345, '#0.00') // 12345.12

Greater(x, y)

Returns true if x is greater than y and false otherwise.

Greater(5, 5)    // false
Greater(5, 4) // true

If(condition, ifTrue, ifFalse)

Returns ifTrue, if condition is true, or ifFalse otherwise.

If(true, "a", "b")                 // "a"
If(false, "a", "b") // "b"
If(true, If(true, "a", "b"), "c") // "a"
If(Eq(10, 50), 1, 0) // 0

Ln(x)

Returns the natural logarithm of x.

Ln(1)    // 0
Ln(E) // 1

Log(x, base)

Returns the logarithm of x expressed in the base specified by base.

Log(25, 5)    // 2

Log10(x)

Returns the 10-based logarithm of x.

Log10(100)    // 2

Max([x1, x2, x3 ...])

Returns the maximum value from the specified array of numbers.

Max([15, 21])    // 21

Median([x1, x2, x3...])

Calculates the median of the numbers. Arguments are a set of numbers enclosed in square brackets.

Median([0, 2, 5])       // 2
Median([0, 2, 5, 9]) // 2.5

Min([x1, x2, x3 ...])

Returns the minimum value from the specified array of numbers.

Min([15, 21])    // 15

Mod(x, y)

Returns the remainder of dividing x by y.

Mod(8, 3)    // 2

Mul(x, y)

Returns the product of x and y.

Mul(10, 1.5)    // 15

Neg(x)

Returns x with opposite sign.

Neg(-5)    // 5
Neg(12) // -12

Not(a)

Returns logical negation of the a.

Not(true)     // false
Not(5 < 1) // true

NotEq(x, y)

Returns false if x equal to y and true otherwise.

NotEq(5, 5)           // false
NotEq(true, false) // true

NotGreater(x, y)

Returns true if x is less than or equal to y and false otherwise.

NotGreater(5, 5)    // true
NotGreater(6, 5) // false

NotSmaller(x, y)

Returns true if x is greater than or equal to y and false otherwise.

NotSmaller(5, 5)    // true
NotSmaller(5, 6) // false

Or(a, b)

Returns logical disjunction of boolean a and b.

Or(true, false)        // true
Or(5 == 6, 20 < 10) // false

Percentile(nums, percentage)

Returns a value from nums below which a given percentage of values fall. percentage is in the range 0..1

Percentile(([1, 2, 3, 4], 0.25))     // 2
Percentile(([1, 2, 3, 4], 0.75)) // 4

Pow(x, exponent)

Returns x to the power of exponent.

Pow(2, 3)     // 8
Pow(2, -2) // 0.25

Qualifier(x)

Extracts the qualifier from a qualified number x.

Qualifier(Qnum(1.5, "="))   // =
Qualifier(Qnum(1.5, "<")) // <
Qualifier(Qnum(1.5, ">")) // >

RandBetween(m, n)

Returns a random integer number within the range from m, inclusive, to n, exclusive.

RandBetween(5, 7)    // Randomly returns 5 or 6

Rnd(limit)

Returns a random integer number within the range from 0, inclusive, to n, exclusive. The absolute value is taken if the number is negative.

Rnd(2)    // Randomly returns 0 or 1

Round(x)

Returns the integer closest to x. Function rounds away from zero when there is no closest integer.

Round(3.4)     // 3
Round(3.5) // 4
Round(-3.5) // -4

RoundFloat(x, decimalPlaces)

Returns the number rounded up x to the number of decimal places specified by decimalPlaces.

decimalPlaces can be negative to round to even 10s, 100s, etc.

RoundFloat(PI, 2)      // 3.14
RoundFloat(25, -1) // 30

Sin(x)

Returns the sine of the x.

Sin(0)         // 0
Sin(PI / 6) // 0.5

Smaller(x, y)

Returns true if x is less than y and false otherwise.

Smaller(5, 5)    // false
Smaller(5, 6) // true

Sqrt(x)

Returns the square root of the x.

Sqrt(6.25)    // 2.5

Sub(x, y)

Returns the difference between x and y.

Sub(10, 3)    // 7

Tan(x)

Returns the tangent of the x.

Tan(0)         // 0
Tan(PI / 6) // 0.5

Xor(a, b)

Returns logical exclusive disjunction of boolean a and b.

Xor(true, false)        // true
Xor(5 == 5, 10 < 20) // false
  • Abs(x)
  • Acos(x)
  • Add(x, y)
  • And(a, b)
  • Asin(x)
  • Atan(x)
  • Atan2(x, y)
  • Avg(x1, x2, x3...)
  • Ceil(x)
  • Cos(x)
  • Div(x, y)
  • Eq(x, y)
  • Exp(x)
  • Fixed(x, decimalPlaces)
  • Floor(x)
  • FormatFloat(x, format)
  • Greater(x, y)
  • If(condition, ifTrue, ifFalse)
  • Ln(x)
  • Log(x, base)
  • Log10(x)
  • Max(x1, x2, x3 ...)
  • Median(x1, x2, x3...)
  • Min(x1, x2, x3 ...)
  • Mod(x, y)
  • Mul(x, y)
  • Neg(x)
  • Not(a)
  • NotEq(x, y)
  • NotGreater(x, y)
  • NotSmaller(x, y)
  • Or(a, b)
  • Percentile(nums, percentage)
  • Pow(x, exponent)
  • Qualifier(x)
  • RandBetween(m, n)
  • Rnd(limit)
  • Round(x)
  • RoundFloat(x, decimalPlaces)
  • Sin(x)
  • Smaller(x, y)
  • Sqrt(x)
  • Sub(x, y)
  • Tan(x)
  • Xor(a, b)