Skip to main content
Version: 1.x

Math functions

These functions can be used when analysing numeric data and numeric collections.

FunctionDescription
math::abs()Returns the absolute value of a number
math::bottom()Returns the bottom X set of numbers in a set of numbers
math::ceil()Rounds a number up to the next largest integer
math::eRepresents the base of the natural logarithm
math::fixed()Returns a number with the specified number of decimal places
math::floor()Rounds a number down to the nearest integer
math::infRepresents positive infinity
math::interquartile()Returns the interquartile of an array of numbers
math::max()Returns the maximum number in a set of numbers
math::mean()Returns the mean of a set of numbers
math::median()Returns the median of a set of numbers
math::midhinge()Returns the midhinge of a set of numbers
math::min()Returns the minimum number in a set of numbers
math::mode()Returns the value that occurs most often in a set of numbers
math::nearestrank()Returns the nearest rank of an array of numbers
math::percentile()Returns the value below which a percentage of data falls
math::piRepresents the mathematical constant π.
math::product()Returns the product of a set of numbers
math::round()Rounds a number up or down to the nearest integer
math::spread()Returns the spread of an array of numbers
math::sqrt()Returns the square root of a number
math::stddev()Calculates how far a set of numbers are away from the mean
math::sum()Returns the total sum of a set of numbers
math::tauRepresents the mathematical constant τ.
math::top()Returns the top X set of numbers in a set of numbers
math::trimean()The weighted average of the median and the two quartiles
math::variance()Calculates how far a set of numbers are spread out from the mean

math::abs

The math::abs function returns the absolute value of a number.

API DEFINITION
math::abs(number) -> number

The following example shows this function, and its output, when used in a RETURN statement:

RETURN math::abs(-13.746189);

13.746189

math::bottom

The math::bottom function returns the bottom X set of numbers in a set of numbers.

API DEFINITION
math::bottom(array<number>, number) -> number

The following example shows this function, and its output, when used in a RETURN statement:

RETURN math::bottom([1, 2, 3], 2);

[ 2, 1 ]

math::ceil

The math::ceil function rounds a number up to the next largest integer.

API DEFINITION
math::ceil(number) -> number

The following example shows this function, and its output, when used in a RETURN statement:

RETURN math::ceil(13.146572);

14

math::e

The math::e constant represents the base of the natural logarithm.

API DEFINITION
math::e -> number

The following example shows this function, and its output, when used in a RETURN statement:

RETURN math::e;

2.718281828459045f

math::fixed

The math::fixed function returns a number with the specified number of decimal places.

API DEFINITION
math::fixed(number, number) -> number

The following example shows this function, and its output, when used in a RETURN statement:

RETURN math::fixed(13.146572, 2);

13.15

math::floor

The math::floor function rounds a number down to the nearest integer.

API DEFINITION
math::floor(number) -> number

The following example shows this function, and its output, when used in a RETURN statement:

RETURN math::floor(13.746189);

13

math::inf

The math::inf constant represents positive infinity.

API DEFINITION
math::inf -> number

The following example shows this function, and its output, when used in a RETURN statement:

RETURN math::inf;

inf

math::interquartile

The math::interquartile function returns the interquartile of an array of numbers.

API DEFINITION
math::interquartile(array<number>) -> number

The following example shows this function, and its output, when used in a RETURN statement:

RETURN math::interquartile([ 1, 40, 60, 10, 2, 901 ]);

51

math::max

The math::max function returns the maximum number in a set of numbers.

API DEFINITION
math::max(array<number>) -> number

The following example shows this function, and its output, when used in a RETURN statement:

RETURN math::max([ 26.164, 13.746189, 23, 16.4, 41.42 ]);

41.42

math::mean

The math::mean function returns the mean of a set of numbers.

API DEFINITION
math::mean(array<number>) -> number

The following example shows this function, and its output, when used in a RETURN statement:

RETURN math::mean([ 26.164, 13.746189, 23, 16.4, 41.42 ]);

24.1460378

math::median

The math::median function returns the median of a set of numbers.

API DEFINITION
math::median(array<number>) -> number

The following example shows this function, and its output, when used in a RETURN statement:

RETURN math::median([ 26.164, 13.746189, 23, 16.4, 41.42 ]);

23

math::midhinge

The math::midhinge function returns the midhinge of an array of numbers.

API DEFINITION
math::midhinge(array<number>) -> number

The following example shows this function, and its output, when used in a RETURN statement:

RETURN math::midhinge([ 1, 40, 60, 10, 2, 901 ]);

29.5

math::min

The math::min function returns the minimum number in a set of numbers.

API DEFINITION
math::min(array<number>) -> number

The following example shows this function, and its output, when used in a RETURN statement:

RETURN math::min([ 26.164, 13.746189, 23, 16.4, 41.42 ]);

13.746189

math::mode

The math::mode function returns the value that occurs most often in a set of numbers. In case of a tie, the highest one is returned.

API DEFINITION
math::mode(array<number>) -> number

The following example shows this function, and its output, when used in a RETURN statement:

RETURN math::mode([ 1, 40, 60, 10, 2, 901 ]);

901

math::nearestrank

The math::nearestrank function returns the nearestrank of an array of numbers.

API DEFINITION
math::nearestrank(array<number>, number) -> number

The following example shows this function, and its output, when used in a RETURN statement:

RETURN math::nearestrank([1, 40, 60, 10, 2, 901], 50);

40

math::percentile

The math::percentile function returns the value below which a percentage of data falls.

API DEFINITION
math::percentile(array<number>, number) -> number

The following example shows this function, and its output, when used in a RETURN statement:

RETURN math::percentile([1, 40, 60, 10, 2, 901], 50);

25

math::pi

The math::pi constant represents the mathematical constant π.

API DEFINITION
math::pi -> number

The following example shows this function, and its output, when used in a RETURN statement:

RETURN math::pi;

3.141592653589793f

math::product

The math::product function returns the product of a set of numbers.

API DEFINITION
math::product(array<number>) -> number

The following example shows this function, and its output, when used in a RETURN statement:

RETURN math::product([ 26.164, 13.746189, 23, 16.4, 41.42 ]);

5619119.004884841504

math::round

The math::round function rounds a number up or down to the nearest integer.

API DEFINITION
math::round(number) -> number

The following example shows this function, and its output, when used in a RETURN statement:

RETURN math::round(13.53124);

14


math::tau

The math::tau constant represents the mathematical constant τ, which is equal to 2π.

API DEFINITION
math::tau -> number

The following example shows this function, and its output, when used in a RETURN statement:

RETURN math::tau;

6.283185307179586f

math::spread

The math::spread function returns the spread of an array of numbers.

API DEFINITION
math::spread(array<number>) -> number

The following example shows this function, and its output, when used in a RETURN statement:

RETURN math::spread([ 1, 40, 60, 10, 2, 901 ]);

900

math::sqrt

The math::sqrt function returns the square root of a number.

API DEFINITION
math::sqrt(number) -> number

The following example shows this function, and its output, when used in a RETURN statement:

RETURN math::sqrt(15);

3.872983346207417

math::stddev

The math::stddev function calculates how far a set of numbers are away from the mean.

API DEFINITION
math::stddev(array<number>) -> number

The following example shows this function, and its output, when used in a RETURN statement:

RETURN math::stddev([ 1, 40, 60, 10, 2, 901 ]);

359.37167389765153

math::sum

The math::sum function returns the total sum of a set of numbers.

API DEFINITION
math::sum(array<number>) -> number

The following example shows this function, and its output, when used in a RETURN statement:

RETURN math::sum([ 26.164, 13.746189, 23, 16.4, 41.42 ]);

120.730189

math::top

The math::top function returns the top of an array of numbers.

API DEFINITION
math::top(array<number>, number) -> number

The following example shows this function, and its output, when used in a RETURN statement:

RETURN math::top([1, 40, 60, 10, 2, 901], 3);

[ 40, 901, 60 ]

math::trimean

The math::trimean function returns the trimean of an array of numbers.

API DEFINITION
math::trimean(array<number>) -> number

The following example shows this function, and its output, when used in a RETURN statement:

RETURN math::trimean([ 1, 40, 60, 10, 2, 901 ]);

27.25

math::variance

The math::variance function returns the variance of an array of numbers.

API DEFINITION
math::variance(array<number>) -> number

The following example shows this function, and its output, when used in a RETURN statement:

RETURN math::variance([ 1, 40, 60, 10, 2, 901 ]);

129148