@servicenow/sdk - v4.4.1
    Preparing search index...
    interface MathFns {
        abs: Abs;
        add: Add;
        average: Average;
        divide: Divide;
        max: Max;
        median: Median;
        min: Min;
        multiply: Multiply;
        power: Power;
        round: Round;
        sqrt: Sqrt;
        subtract: Subtract;
        sum: Sum;
        toFixedValue: ToFixedValue;
    }
    Index

    Properties

    abs: Abs

    A mathematical function that returns the distance from zero for any real number. An absolute value is always a positive or zero value.

    The numeric value whose absolute value should be returned.

    as the absolute value of the result of the input number.

    abs(-3); // → 3
    

    If the transform function receives a non-numeric input value, it returns the original input value unchanged.

    add: Add

    A mathematical function that adds the given value to the input.

    The base number.

    Number to be added.

    As the addition of the input value by the parameter.

    add(12, 4); // → 16
    

    If the input and parameter data types are not Number, the data is not transformed at runtime.

    average: Average

    A mathematical function that returns the average value of the elements in the input Array.

    An array of numbers, e.g. [1, 2, 3].

    Number - As average value in input Array.

    average([1, 2, 3]); // → 2
    

    If the input data type is not Array, the data is not transformed at runtime.

    divide: Divide

    A mathematical function that divides the input value by a given value.

    The dividend.

    The divisor (non-zero) - Number to be divided.

    Number - As division of the input value by the parameter.

    divide(10, 2); // → 5
    

    If the input and parameter data types are not Number, the data is not transformed at runtime.

    max: Max

    Returns the highest value found in the input Array.

    An array of numbers.

    Number - As highest value in input Array.

    max([3, 7, 2]); // → 7
    

    If the input data type is not Array.Number, the data is not transformed at runtime.

    median: Median

    A mathematical function that returns the median value of elements in the input Array.

    An array of numbers.

    Number - As median value in input Array.

    median([1, 3, 5]); // → 3
    

    If the input data type is not Array.Number, the data is not transformed at runtime.

    min: Min

    Returns the lowest value found in the input Array.

    An array of numbers.

    Number - As lowest value in input Array.

    min([3, 7, 2]); // → 2
    

    If the input data type is not Array.Number, the data is not transformed at runtime.

    multiply: Multiply

    A mathematical function that multiplies the input value by a given value.

    The base number.

    The multiplier.

    Number - As multiplication of the input value by the parameter.

    multiply(6, 2); // → 12
    

    If the input and parameter data types are not Number, the data is not transformed at runtime.

    power: Power

    A mathematical function that returns the value of the input value raised to the power of a given value.

    The base number.

    Number - Exponent of the power.

    Number - As the power of input value to the parameter.

    power(2, 3); // → 8
    

    If the input and parameter data types are not Number, the data is not transformed at runtime.

    round: Round

    A mathematical function that approximates a numeric value based on rounding rules and a digit position. The function rounds up by adding one to the digit to be rounded and then replacing all digits to its right with zeroes.

    The number to round.

    Number of Digits - A positive integer specifying the position of the digit to be rounded starting on the left.

    Number - as the rounded value of the input Number.

    round(1.93456, 2); // → 1.93
    

    The function uses the digit to the right of the parameter digit to round up or down. If the digit to the right has a value of 0 to 4, the function rounds down. If the digit to the right has a value of 5 to 9, then the function rounds up. If there is no digit to the right, then the function rounds down.

    sqrt: Sqrt

    A mathematical function that computes a positive number that when multiplied by itself produces the input value. The input value must be a positive real number.

    A non-negative number.

    Number - as the square root of the input Number.

    sqrt(9); // → 3
    

    If the transform function receives a non-numeric or negative input value, it returns the original input value unchanged.

    subtract: Subtract

    A mathematical function that subtracts the given value from the input.

    A number value

    Number to be subtracted.

    Number - as the subtraction of the input value by the parameter.

    subtract(10, 4); // → 6
    

    If the input and parameter data types are not Number, the data is not transformed at runtime.

    sum: Sum

    Returns the sum of all values in the input Array.

    An array of numbers, e.g. [1, 2, 3].

    Number - as the sum of all values in the input Array.

    sum([1, 2, 3]); // → 6
    

    If the input data type is not Array.Number, the data is not transformed at runtime.

    toFixedValue: ToFixedValue

    Returns a string representation of a floating point number fixed to the number of digits specified

    The number to format.

    Number of Digits - A positive integer specifying the position of the digit to be precisioned starting on the left.

    Number - as the fixed value of the input Number.

    toFixedValue(1.93456, 2); // → 1.93
    

    If the input data type is not Number, the data is not transformed at runtime.