Troubleshooting and Reference Guide : Available Functions : Using Core Functions : Arithmetic Functions
 
Share this page                  
Arithmetic Functions
The Arithmetic category provides functions for doing basic arithmetic functions. The arithmetic functions work on numeric typed fields:
double
float
int (integer)
long
numeric (equivalent to the Java BigDecimal type)
Parameters to the arithmetic functions are one of the following:
The name of the field to use as the input value
A constant value
A function that provides a numeric result
Function Name
RushScript Symbol
Description
Output Type
Parameters
+
Add two numeric values.
Wider of the two input types
Two numeric typed fields
Arithmetic.div
/
Divide the first value by the second value.
Wider of the two input types
Two numeric typed fields
Arithmetic.mult
*
Multiply two numeric values.
Wider of the two input types
Two numeric typed fields
Arithmetic.neg
-
Negate a numeric value.
Same as the input type
One numeric typed field
Arithmetic.remainder
%
Remainder from dividing the values.
Wider of the two input types
Two numeric typed fields
Arithmetic.sub
-
Subtract the second value from the first value.
Wider of the two input types
Two numeric typed fields
The Arithmetic category also provides the following function, specifically for numeric typed operations.
Function Name
Description
Output Type
Parameters
Arithmetic.scaledDiv
Divide the first value by the second value, using BigDecimal division, to the specified scale.
Numeric
Numeric type dividend
Numeric type divisor
Integer scale
Arithmetic.add(augend, addend)
Adds two numeric values.
Parameters
 
Parameter
Type
Description
augend
Numeric or narrower
A numeric value to add.
addend
Numeric or narrower
A numeric value to add.
Return Type
The wider of the two input types.
Examples
Java
ScalarValuedFunction field1 = FieldReference.value("field1");
ScalarValuedFunction const10 = ConstantReference.constant(10);
ScalarValuedFunction field1Plus10 = Arithmetic.add(field1, const10);
Expression Language
`field1` + 10