Skip to content

Math

The Math operation folds one or more numeric inputs with an arithmetic operator — addition, subtraction, multiplication, division, or modulus — and writes the Float result to a single output.

Addition and multiplication fold commutatively. Subtraction and division are left-associative: Data1 − Data2 − … and Data1 / Data2 / …, so Data1 is the distinguished minuend / dividend. Modulus is restricted to exactly two Data inputs.

To render the Float result as an Integer (truncated or rounded) or a formatted String, chain a Convert node downstream.

With exactly one Data input connected, every operation but Modulus passes that value through unchanged, and the Editor shows an info badge on the Node saying so; Modulus requires exactly two and is exempt. An unconnected Data port is the Task Compiler’s mandatory-input error instead.

Math operation

Inputs

PortTypeRequiredDescription
> (Gate)AnyNoWhen connected, a false or Nil value stops the path. See Gate Inputs.
DataInteger or FloatYes (first port)Numeric operand. Up to 20 Data ports total — the first is mandatory, the rest are added on demand in the Node’s Settings tab. Modulus requires exactly 2.

Outputs

PortTypeDefaultDescription
OutFloatNilFold result.

Properties

NameTypeDefaultDescription
Operation TypeComboAddition (+)Arithmetic operation: Addition (+), Subtraction (-), Multiplication (*), Division (/), Modulus (%).
On ErrorComboStop this branchPer-op On Error verb (Stop this branch / Continue with the last value / Continue with the fallback). See the Error Handling guide.
Out → Fallbackbool / int / float / stringNilPer-output fallback value used when Continue with the fallback fires. Edit in Settings under the Out port.

State on Reload

Output is preserved across restarts within the configured time window.


OperationN-ary meaningSingle-input result
AdditionΣ Dataᵢreturns the input
MultiplicationΠ Dataᵢreturns the input
SubtractionData1 − (Data2 + Data3 + … + DataN)returns the input
DivisionData1 / (Data2 · Data3 · … · DataN) (any zero → fail)returns the input
ModulusData1 % Data2, N must be 2— (compile error)

All connected Data ports contribute to the fold; any unconnected Mandatory Data port is an error and invokes the On Error verb.


  1. Gate check — If a Gate Input is connected, evaluate it. A false or Nil value stops the execution path; outputs keep their previous values. (Not an error.)

  2. Collect values — Read every Data input. A missing Mandatory input or a non-numeric value invokes the On Error verb.

  3. Fold — The selected operation is applied according to the table above. Division / modulus by zero invokes the On Error verb.

  4. Emit — The Float result is written to Out.


Operation: +   Data1: 10   Data2: 5

Output: 15


  • Summing or averaging sensor readings from any number of sources in one node.
  • Building weighted chains (multi-factor division / subtraction).
  • Unit conversions and scaling.
  • Implementing conditional numeric thresholds.
  • Performing modular arithmetic for cyclic counters (two operands only).
  • Converting a Numeric value into a typed Integer or formatted String with a single-input fold.

Math can hit these errors: an unconnected Mandatory Data port, a non-numeric value on a Data port (the Type mask catches most of these earlier), division or modulus by zero, or a modulus node with anything other than exactly 2 Data ports.

Any of these routes through the per-op On Error verb and the per-output Fallback value. See the Error Handling guide for full details on the verbs and how they compose with the Fallback editor.

VerbWhat it does
Stop this branch (default)This Node and its dependents stop; Out keeps its value and reads as a failed update.
Continue with the last valueDependents run on the value Out already holds, not stamped as new; it reads as a failed update.
Continue with the fallbackDependents run on Out’s per-output Fallback, stamped as this run’s value; it reads as a failed update. The Editor refuses a Task where the Fallback is unset.

Math-specific recipes:

  • Continue with the fallback + Out → Fallback = 0.0 — emits zero on every failure. The classic “treat divide-by-zero as zero” pattern.
  • Continue with the fallback + Out → Fallback = NaN — emits quiet NaN, which downstream Compare nodes can detect via “not equal to itself”.

Gate closure is not an error — a closed Gate stops the Path and consults no verb.


  • Modulus requires exactly 2 Data inputs — a compile-time check.
  • Modulus always operates on integers internally (inputs are rounded before the modulus computation; the Float result carries the integer value).
  • Division treats any near-zero divisor in the chain as an error.
  • Non-numeric inputs are rejected at the runtime type check or inside the op; either way the Node fails and its On Error verb resolves the failure.
  • Maximum fan-in is 20 Data ports.