Skip to main content
Version: Next

Numeric functions

decimal(n, scale)

Rounds the given value at the given scale.

Function signature

decimal(n: number, scale: number): number

Examples

decimal(1/3, 2)
// .33

decimal(1.5, 0)
// 2

floor(n)

Rounds the given value with rounding mode flooring.

Function signature

floor(n: number): number

Examples

floor(1.5)
// 1

floor(-1.5)
// -2

floor(n, scale)

Rounds the given value with rounding mode flooring at the given scale.

Function signature

floor(n: number, scale: number): number

Examples

floor(-1.56, 1)
// -1.6

ceiling(n)

Rounds the given value with rounding mode ceiling.

Function signature

ceiling(n: number): number

Examples

ceiling(1.5)
// 2

ceiling(-1.5)
// -1

ceiling(n, scale)

Rounds the given value with rounding mode ceiling at the given scale.

Function signature

ceiling(n: number, scale: number): number

Examples

ceiling(-1.56, 1)
// -1.5

round up(n, scale)

Rounds the given value with the rounding mode round-up at the given scale.

Function signature

round up(n: number, scale: number): number

Examples

round up(5.5)
// 6

round up(-5.5)
// -6

round up(1.121, 2)
// 1.13

round up(-1.126, 2)
// -1.13

round down(n, scale)

Rounds the given value with the rounding mode round-down at the given scale.

Function signature

round down(n: number, scale: number): number

Examples

round down(5.5, 0)
// 5

round down (-5.5, 0)
// -5

round down (1.121, 2)
// 1.12

round down (-1.126, 2)
// -1.12

round half up(n, scale)

Rounds the given value with the rounding mode round-half-up at the given scale.

Function signature

round half up(n: number, scale: number): number

Examples

round half up(5.5, 0)
// 6

round half up(-5.5, 0)
// -6

round half up(1.121, 2)
// 1.12

round half up(-1.126, 2)
// -1.13

round half down(n, scale)

Rounds the given value with the rounding mode round-half-down at the given scale.

Function signature

round half down(n: number, scale: number): number

Examples

round half down (5.5, 0)
// 5

round half down (-5.5, 0)
// -5

round half down (1.121, 2)
// 1.12

round half down (-1.126, 2)
// -1.13

abs(number)

Returns the absolute value of the given numeric value.

Function signature

abs(number: number): number

Examples

abs(10)
// 10

abs(-10)
// 10

modulo(dividend, divisor)

Returns the remainder of the division of dividend by divisor.

Function signature

modulo(dividend: number, divisor: number): number

Examples

modulo(12, 5)
// 2

sqrt(number)

Returns the square root of the given value.

Function signature

sqrt(number: number): number

Examples

sqrt(16)
// 4

log(number)

Returns the natural logarithm (base e) of the given value.

Function signature

log(number: number): number

Examples

log(10)
// 2.302585092994046

exp(number)

Returns the Euler’s number e raised to the power of the given number .

Function signature

exp(number: number): number

Examples

exp(5)
// 148.4131591025766

odd(number)

Returns true if the given value is odd. Otherwise, returns false.

Function signature

odd(number: number): boolean

Examples

odd(5)
// true

odd(2)
// false

even(number)

Returns true if the given is even. Otherwise, returns false.

Function signature

even(number: number): boolean

Examples

even(5)
// false

even(2)
// true

random number()

Camunda Extension

Returns a random number between 0 and 1.

Function signature

random number(): number

Examples

random number()
// 0.9701618132579795