Numeric functions




uAbs

Description

Returns the magnitude of a real number, ignoring its positive or negative sign.

NoteThis function can only calculate with numbers. In all other cases, it returns zero.

Syntax

number uAbs(value)

Parameters

number value

A number to calculate on.

Examples

Example 1

To calculate the absolute value:

uAbs(1522) // returns 1522
uAbs(‘-123.45’) // returns 123.45
uAbs(‘123ABC’) // returns 0



uCeil

Description

Returns the least integer greater than or equal to argument.

Syntax

number uCeil(value);

Parameters

number value

A number to calculate on.

Examples

Example 1

To round up numbers:

uCeil(1523.1) // returns 1524
uCeil(1522.9) // returns 1524



uDiv

Description

Returns the division integer.

Syntax

number uDiv(value)

Parameters

number value

A number to calculate on.

Examples

Example 1

To calculate the integer:

uDiv(10, 3) // returns 3



uExp

Description

Returns the exponential, base e.

Syntax

number uExp(value)

Parameters

number value

A number to calculate on.

Examples

Example 1

To calculate an exponential:

uExp(1) ;; returns "2.718281828459045"



uFloor

Description

Returns the greatest integer less than or equal to argument.

Syntax

number uFloor(value)

Parameters

number value

A number to calculate on.

Examples

Example 1

To round up numbers:

uFloor(1523.1) ;; returns 1523
uFloor(1523.9) ;; returns 1523



uLn

Description

Returns the natural logarithm (base E) of a number.

Syntax

number uLn(input);

Parameters

number value

A number to calculate on.

Examples

Example 1

uLn(2.718281828) // returns 0.999999



uLog

Description

Returns the logarithm of a number. If the base parameter is omitted, a base of 10 is taken.

Syntax

number uLog(value [, base])

Parameters

number value

A number to calculate on.

number base

The base for the logarithm. If omitted, a base of 10 will be used.

Examples

Example 1

uLog(100) 	// returns 3
uLog(16, 2) // returns 4 



uMod

Description

Returns the modulo of a division.

Syntax

number uMod(value)

Parameters

number value

A number to calculate on.

Examples

Example 1

To calculate the modulo:

uMod(10, 3) // returns 1



uPow, uPower

Description

Returns the value of a base expression taken to a specified power.

Syntax

number uPow(value)

Parameters

number value

A number to calculate on.

Examples

Example 1

uPow(10, 3) ;; returns "1000"



uRandom

Description

Returns a random number greater than or equal to zero and smaller than one.

Syntax

number uRandom(value)

Parameters

number input

A number to calculate on.

Examples

Example 1

To return a random number:

uRandom()      // returns "0.696654639123727”



uRound

Description

Returns the rounded argument to nearest integer. If the second optional parameter is set, uRound preserves the specified number of digits behind the decimal point.

Syntax

number uRound(value, scale)

Parameters

number value

A number to calculate on.

number scale

Number of digits.

Examples

Example 1

To round numbers:

uRound(10.1)  // returns "10"
uRound(10.49) // returns "10"
uRound(10.5)  // returns "11"
uRound(10.9)  // returns "11"
uRound(1.235, 2)  // returns "1.24"



uSgn

Description

Returns the sign of a given value

Syntax

number uSgn(value)

Parameters

number value

A number to calculate on.

Examples

Example 1

To detecting the sign of a given value:

uSgn(-10.4)  // returns -1
uSgn(0)      // returns 0
uSgn(10.4)   // returns 1 
uSgn(null)   // returns null



uSqrt

Description

Returns the square root of a given value.

Syntax

number uSqrt(value)

Parameters

number value

A number to calculate on.

Examples

Example 1

To calculate a square root:

uSqrt(25)     // returns 5
uSqrt(0)      // returns 0
uSqrt(null)   // returns null