Skip to content

Float Math Operation

Performs common mathematical operations on floating-point numbers. Supports binary operations (add, subtract, multiply, divide, modulo, power) and unary operations (sqrt and abs applied to the first input). Includes safety checks for division/modulo by zero and square root of negative numbers.
Preview

Usage

Use this node whenever you need to compute a float result from one or two float inputs in a workflow. Select the desired operation and supply operands a and b. For unary operations (sqrt, abs), only the first operand a is used but both inputs must still be provided.

Inputs

FieldRequiredTypeDescriptionExample
aTrueFLOATFirst float operand. Used as the left-hand side for binary operations and as the operand for unary operations (sqrt, abs). Accepts values in the range [-1e10, 1e10].9.0
bTrueFLOATSecond float operand. Used for binary operations (add, subtract, multiply, divide, modulo, power). Ignored for unary operations (sqrt, abs). Accepts values in the range [-1e10, 1e10].3.0
operationTrue['add','subtract','multiply','divide','modulo','power','sqrt','abs']Mathematical operation to perform. Binary operations use both a and b. Unary operations (sqrt, abs) apply only to a.divide

Outputs

FieldTypeDescriptionExample
resultFLOATThe computed floating-point result of the selected operation.3.0

Important Notes

  • Division by zero: If b is 0 during divide, the node returns 0.0 and logs a warning.
  • Modulo by zero: If b is 0 during modulo, the node returns 0.0 and logs a warning.
  • Square root domain: If a is negative for sqrt, the node returns 0.0 and logs a warning.
  • Unary operations: For sqrt and abs, only a is used; b is ignored but still required.
  • Value ranges: Inputs a and b accept values from -1e10 to 1e10 with step 0.001.

Troubleshooting

  • Unexpected 0.0 result: Check if you divided or modulo by zero, or attempted sqrt on a negative number; these cases return 0.0 with a warning.
  • Wrong result for unary operations: Ensure you're interpreting b correctly—b is ignored for sqrt and abs.
  • Overflow or extreme values: If results seem off with very large magnitudes, confirm a and b fall within the accepted range [-1e10, 1e10].
  • Unknown operation: If the operation string is outside the allowed set, the node returns 0.0 and logs a warning; verify the operation value.