Skip to content

Int Math Operation

Performs a basic mathematical operation on two integers and returns a single integer result. Supports addition, subtraction, multiplication, integer division, modulo, and exponentiation. Includes safeguards for division/modulo by zero and unknown operations.
Preview

Usage

Use this node whenever you need to compute a simple integer result within a workflow, such as counters, loop indices, or discrete arithmetic. Provide two integer operands and select the desired operation; the node outputs a single INT suitable for downstream logic or calculations.

Inputs

FieldRequiredTypeDescriptionExample
aTrueINTFirst integer operand. Accepts large positive or negative integers within the node's configured range.7
bTrueINTSecond integer operand. Its role depends on the selected operation (e.g., divisor, modulus, exponent).3
operationTrue['add', 'subtract', 'multiply', 'divide', 'modulo', 'power']The mathematical operation to apply to a and b. 'divide' performs integer division, 'modulo' returns the remainder, and 'power' computes a**b.divide

Outputs

FieldTypeDescriptionExample
resultINTThe integer result of the selected operation. Division is integer (floor) division; modulo is the remainder.2

Important Notes

  • Division and modulo by zero are prevented; in such cases the node returns 0 and logs a warning.
  • Division uses integer floor division semantics, which may differ from truncation for negative values.
  • Very large exponents may produce extremely large integers; consider bounds to avoid performance issues.
  • If an unknown operation is provided, the node returns 0 and logs a warning.
  • Input ranges are constrained to large 64-bit-like limits in the UI; values outside may be clamped or rejected.

Troubleshooting

  • Result is 0 unexpectedly: Check if b was 0 for 'divide' or 'modulo', or if 'operation' was misspelled or unsupported.
  • Negative division result looks unexpected: Remember that integer division uses floor semantics (e.g., -3 // 2 equals -2).
  • Performance issues or slow execution: Large 'power' operations can be expensive; reduce operands or choose a different approach.
  • Output not as expected after connecting upstream nodes: Verify that upstream values are integers and within the allowed range.