Skip to main content
Version: 2.20.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: True
Optional Argument Names and DatatypesN/A
Modifiersignore null (Default: True): If True, null values are not included in the calculation. If False, the presence of nulls in the input will return null.
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},constant(2)) ==> {4,5,6}
plus({2,3,4},constant(2),constant(4)) ==> {8,9,10}
plus({2,3,4},{5,6,7}) ==> {7,9,11}

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

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},constant(2)) ==> {3,2,1}
div({6,4,2},{2,2,4}) ==> {3,2,0.5}

div({[1,1,1],[2,2,2],[3,3,3]},{1,2,3}) ==> {[1,1,1],[1,1,1],[1,1,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) ==> 1
mod(35.6,2.5) ==> 0.6
mod([2,3,4],2) ==> [0,1,0]
mod([2,3,null],2) ==> [0,1,null]

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

mod({[2,3,4],[1,2,3],[3,4,5]},{1,2,3}) ==>{[0,0,0],[1,0,1],[0,1,2]}
mod({[2,3,4],[1,2,3],[3,4,5]},constant(3)) ==> {[1,0,1],[1,1,0],[0,1,2]}

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}