Math Helper
Add, divide, round and total numbers in a step.
Do things in Math Helper
Add a Math Helper step and choose an Operation. Choose the row to see the fields of each.
Later steps read a step’s output by its name: see Use data from earlier steps.
What changed in version 2?
New steps use version 2.0.0. A step made before keeps 1.0.0 and works as it always has. The step’s panel shows its version at the top right. On an older step it reads v1.0.0 · 2.0.0 available: press it to choose the version.
In 2.0.0: Results are rounded to 15 significant digits, the precision a spreadsheet uses. So 0.1 + 0.2 gives 0.3, not 0.30000000000000004, and Round to N decimals rounds 1.005 to 1.01. Version 1.0.0 gives the raw computer answer.
Example
Round an order’s total to cents. Add a Math Helper step, choose Round to N decimals, and set Decimal Places to 2. Set Value A to:
{{trigger.body.total}}Not in your list? See When an app isn’t here.
For developers
In the API, which calls apps pieces, Math Helper is pieceId: "math" with actionId: "calculate", set by operation. Get an app returns every field.
It computes from its inputs only (pure). See How versions and side effects work.
Math Helper › Calculate
Apply a math operation to one or two numbers.
Add (+), Subtract (−), Multiply (×), Divide (÷), Modulo (%), Power (^), Minimum and Maximum
- Value A · Required
The first number to work with, such as 10.
- Value B · Required
The second number, used with the first one, such as 3.
Round, Floor, Ceil, Absolute and Square root
- Value A · Required
The first number to work with, such as 10.
Round to N decimals
- Value A · Required
The first number to work with, such as 10.
- Decimal Places · Optional
How many digits to keep after the decimal point, such as 2 turns 3.14159 into 3.14.
Default: 2.
Logarithm
- Value A · Required
The first number to work with, such as 10.
- Base · Optional
Logarithm base (use a blank/0 for natural log e).
Default: 10.
Sum (list) and Average (list)
- Numbers · Required
Array of numbers, such as [1, 2, 3].
Random in range
- Min · Optional
The smallest number the random result can be, such as 1.
Default: 0.
- Max · Optional
The upper bound for the random result, such as 100. With Whole Number on it can be returned; for a decimal result the value stays just below it.
Default: 100.
- Whole Number · Optional
Return a whole number (integer) between Min and Max, both included. Leave off for a decimal result.
Off by default.