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
Category | Details |
---|---|
Number of Arguments | 2+ |
Mandatory Argument Names and Datatypes | arg : An integer or float.
|
Optional Argument Names and Datatypes | N/A |
Modifiers | ignore 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) |
|
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
Category | Details |
---|---|
Number of Arguments | 2 |
Mandatory Argument Names and Datatypes |
|
Optional Argument Names and Datatypes | N/A |
Modifiers | N/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
Category | Details |
---|---|
Number of Arguments | 2 |
Mandatory Argument Names and Datatypes |
|
Optional Argument Names and Datatypes | N/A |
Modifiers | N/A |
Output Datatype(s) |
|
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
Category | Details |
---|---|
Number of Arguments | 2+ |
Mandatory Argument Names and Datatypes | arg : An integer or float.
|
Optional Argument Names and Datatypes | N/A |
Modifiers | ignore 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) |
|
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
Category | Details |
---|---|
Number of Arguments | 2 |
Mandatory Argument Names and Datatypes | arg : An integer or float.
|
Optional Argument Names and Datatypes | N/A |
Modifiers | N/A |
Output Datatype(s) |
|
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}