Skip to content

Math Operations

The Math Operations node performs arithmetic and mathematical operations between two numeric inputs or generates random numbers within a defined range.


Dependencies

No external service or node dependencies are required for this node.


Operations

OperationDescription
AddAdds Value1 and Value2.
SubtractSubtracts Value2 from Value1.
MultiplyMultiplies Value1 by Value2.
DivideDivides Value1 by Value2.
ModuloFinds remainder of Value1 divided by Value2.
RoundRounds Value1 based on the provided Precision.
RandomGenerates a random number between Value1 and Value2.

Input Fields

LabelInput TypeDescriptionRequiredVisible WhenDefaultExample
Value1NumberThe first number that the math operation uses.✅ YesAlwaysNull1
Value2NumberThe second number that the math operation uses.✅ YesAlwaysNull3
OperationPicklistThe math operation that will be used.✅ YesAlwaysNullAdd
PrecisionNumberDecimal places to round to.⚠️ When VisibleWhen Operation is RoundNull2

Output

The result of the math operation can be referenced downstream using {{MathOperations-#.Result}} test.


Examples

Add – Add two numbers together.

Add Value1 to Value2

FieldValue
Value110
Value23
OperationAdd
Output13
Subtract – Subtract one number from another.

Subtract Value2 from Value1

FieldValue
Value110
Value23
OperationSubtract
Output7
Multiply – Multiply one number by another.

Multiply Value1 by Value2

FieldValue
Value110
Value23
OperationMultiply
Output30
Divide – Divide one number by another.

Divide Value1 by Value2

FieldValue
Value112
Value23
OperationDivide
Output4
Modulo – Get the remainder after dividing one number by another.

Get the remainder after diving Value1 by Value2

FieldValue
Value110
Value23
OperationModulo
Output1
Round – Round one number by a provided precision.

Round Value1 by the Precision provided

FieldValue
Value110.05203
Value21 Check Developer Notes
OperationRound
Precision2
Output10.05
Random – Generate a random number between one number and another.

Genereates a random number between Value1 and Value2

FieldValue
Value11
Value210
OperationRound
Output5.757634544209118

Potential Errors

Error ConditionDescription
Unsupported operation:An operation has not been selected in the node properties.
Failed to get string from object for key propertynameA node property is missing a value or an incorrect data type has been entered.
Value2 cannot be zero.Value2 must not be 0 when using the divide operation.

Developer Notes

  • The round node only uses Value1, however a random value has to be entered for Value2 to prevent an error.
  • When using the divide operator, Value2 must not be 0.

Tentech 2024