$CTMMathUtil Variable

The predefined $CTMMathUtil variable provides access to basic math utilities.

getMin Method

Short Description
returns the smallest value of an array of doubles.
Syntax
Double getMin(ArrayList<Double> inputArray)
Parameter
input
an array of double values.
Return Value
returns the double value that is the smallest in the input array. This function returns NaN if the inputArray is null or if an exception occurs while trying to process the array.
Example
#set($array = [1.0, 2.0, 3.0])
$CTMMathUtil.getMin($array)

/* double returned: 1.0 */

getMax Method

Short Description
returns the largest value of an array of doubles.
Syntax
Double getMax(ArrayList<Double> inputArray)
Parameter
input
an array of double values.
Return Value
returns the double value that is the largest in the input array. This function returns NaN if the inputArray is null or if an exception occurs while trying to process the array.
Example
#set($array = [1.0, 2.0, 3.0])
$CTMMathUtil.getMax($array)

/* double returned: 3.0 */

getSum Method

Short Description
returns the smallest value of an array of doubles.
Syntax
Double getSum(ArrayList<Double> inputArray)
Parameter
input
an array of double values.
Return Value
returns the double value that is the sum of all the values in the input array. This function returns NaN if the inputArray is null or if an exception occurs while trying to process the array.
Example
#set($array = [1.0, 2.0, 3.0])
$CTMMathUtil.getSum($array)

/* double returned: 6.0 */