Skip to main content
Version: 2.15.X

Arithmetic Operations

Arithmetic operations provide mechanisms for performing basic calculations.

The examples for each function use the following notation:

  • Square brackets ([]) indicate arrays.
  • Curly braces ({}) indicate groups.
  • Arrows (==>) separate inputs and outputs. Inputs are shown on the left side of the arrow. Outputs are shown on the right side of the arrow.

Add

The Add function returns the sum of two or more input variables.

Usage Information

CategoryDetails
Number of Arguments2+
Mandatory Argument Names and Datatypesarg: An integer or float.
  • Scalar Support: True
  • Array Support: True
  • Group of Scalars Support: True
  • Group of Arrays Support: False
Optional Argument Names and DatatypesN/A
Modifiersignore null (Default: True): If True, null values are not included in the calculation. If False, nulls are included in the calculation and assigned a 0 value.
Output Datatype(s)
  • Integer (if all inputs are integers)
  • Float

Examples

plus(2,3,4) ==> 9
plus(2,3.5) ==> 5.5
plus(2,null,ignoreNull=False) ==> null
plus(2,null,ignoreNull=True) ==> 2

plus([1,2,3], 2) ==> [3,4,5]

plus({2,3,4},2) ==> {4,5,6}
plus({2,3,4},2,4) ==> {8,9,10}
plus({2,3,4},{5,6,7}) ==> {7,9,11} // parameters must be from same element

Divide

The Divide function returns the quotient of the two input variables.

Usage Information

CategoryDetails
Number of Arguments2
Mandatory Argument Names and Datatypes
  • numerator: An integer or float to serve as the numerator.
  • denominator: An integer or float to serve as the denominator.
  • Scalar Support: True
  • Array Support: True
  • Group of Scalars Support: True
  • Group of Arrays Support: True
Optional Argument Names and DatatypesN/A
ModifiersN/A
Output Datatype(s)Float

Examples

div(6,2) ==> 3.0
div(6,0) ==> null
div(6,null) ==> null

div([6,4,2],2) ==> [3,2,1]
div({6,4,2},2) ==> {3,2,1}

Modulus

The Modulus function returns the remainder from dividing the first argument by the second argument.

Usage Information

CategoryDetails
Number of Arguments2
Mandatory Argument Names and Datatypes
  • numerator: An integer or float to serve as the numerator.
  • denominator: An integer or float to serve as the denominator.
  • Scalar Support: True
  • Array Support: True
  • Group of Scalars Support: True
  • Group of Arrays Support: True
Optional Argument Names and DatatypesN/A
ModifiersN/A
Output Datatype(s)
  • Integer (if both inputs are integers)
  • Float

Examples

mod(5,2) ==> 2
mod(35.6,2.5) ==> 0.6
mod([2,3,4],2) ==> [0,1,0]

mod({2,3,4},2) ==> {0,1,0}
mod({2,3,4},{1,2,3}) ==> {0,1,3}

Multiply

The Multiply function returns the product of two or more input variables.

Usage Information

CategoryDetails
Number of Arguments2+
Mandatory Argument Names and Datatypesarg: An integer or float.
  • Scalar Support: True
  • Array Support: True
  • Group of Scalars Support: True
  • Group of Arrays Support: False
Optional Argument Names and DatatypesN/A
Modifiersignore null (Default: True): If True, null values are not included in the calculation. If False, nulls are included in the calculation and assigned a value of 1.
Output Datatype(s)
  • Integer (if all inputs are integers)
  • Float

Examples

mult(2,6) ==> 12
mult(2,3,0.5) ==> 3.0
mult(2,null,ignoreNull=False) ==> null
mult(2,null,ignoreNull=True) ==> 2

mult([1,2,3],2) ==> [2,4,6]

mult({2,3,4},2) ==> {4,6,8}
mult({2,3,4},{2,4,6}) ==> {4,12,24} // parameters must be from same element

Subtract

The Subtract function returns the difference between the two input variables.

Usage Information

CategoryDetails
Number of Arguments2
Mandatory Argument Names and Datatypesarg: An integer or float.
  • Scalar Support: True
  • Array Support: True
  • Group of Scalars Support: True
  • Group of Arrays Support: False
Optional Argument Names and DatatypesN/A
ModifiersN/A
Output Datatype(s)
  • Integer (if both inputs are integers)
  • Float

Examples

subtract(3,5) ==> -2 
subtract(4,2.5) => 1.5
subtract(4,null) ==> null

subtract({6,4,1},2) ==> {4,2,-1}
subtract({5,4,3},{2,3,4}) ==> {3,1,-1}