abs Function
Returns the absolute value of its argument.
Synopsis
%result = abs(value)
Parameters
|
Name |
Type |
Required? |
Description |
|---|---|---|---|
|
|
number |
yes |
The value whose absolute value is requested |
Returns
-
If
valueis a positive number or 0, returnsvalue. -
If
valueis a negative number, returns the absolutevalueof value, i.e. with the negative sign removed. -
If
valueis a string, returns 0.
bool function
Converts a value into the number 0 or 1.
Synopsis
%bool_value = bool(%some_value)
Parameters
|
Name |
Type |
Required? |
Description |
|---|---|---|---|
|
|
any |
yes |
The value to convert |
Returns
-
If
valueis an empty string or the number 0 or a string represents the numeric value 0, returns 0. -
Otherwise, returns 1.
integer function
Converts a value into a number.
Synopsis
%num = integer(%string_variable)
Parameters
|
Name |
Type |
Required? |
Description |
|---|---|---|---|
|
|
any |
yes |
The value to convert |
Returns
-
If
valueis a number, returns number. -
If
valueis a string which can be interpreted as a number, it returnsnumberconverted to a number. -
Otherwise, returns 0.
min, max functions
Returns the smallest (min) or largest (max) value from its parameter list.
Synopsis
%smallest = min(value1, value2, ...)
%largest = max(value1, value2, ...)
Parameters
Both functions require at least one parameter; and number of additional parameters is allowed. Parameter values which cannot be converted into a number are replaced by the number 0.
Returns
-
min returns the smallest value of all its parameters.
-
max returns the largest value of all its parameters.
pow function
Calculates the power of a number.
Synopsis
%result = pow(2, 3) // returns 8
Parameters
|
Name |
Type |
Required? |
Description |
|---|---|---|---|
|
|
number |
yes |
The base of the power |
|
|
number |
yes |
The exponent of the power |
Returns
The base, taken to the exponent-th power, rounded towards zero to the nearest integer.
Behaviour is undefined in case of arithmetic overflow.
random function
Generates a random number within the specified limits.
Synopsis
%rnd = random(10, 20)
Parameters
|
Name |
Type |
Required? |
Description |
|---|---|---|---|
|
|
number |
yes |
The lower bound |
|
|
number |
yes |
The upper bound; must be greater than or equal to |
Returns
A number randomly chosen between minimum and maximum (including both limits).
Numbers are evenly distributed in the interval, but sequential correlations may exist.