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 on the first input (sqrt, abs). Includes safety checks for invalid cases like division/modulo by zero and square root of negative numbers, returning 0.0 in those cases.
Preview

Usage

Use this node when you need to compute a single floating-point result from one or two float inputs within a workflow. Typical use cases include parameter calculations, normalization steps, or building simple arithmetic pipelines. Choose the operation and provide inputs; for unary operations (sqrt, abs), only the first input is used.

Inputs

FieldRequiredTypeDescriptionExample
aTrueFLOATFirst float operand. Used as the base value for all operations; for sqrt and abs this is the only value used.9.0
bTrueFLOATSecond float operand. Used for binary operations (add, subtract, multiply, divide, modulo, power). Ignored for sqrt and abs.3.0
operationTrueSTRING (one of: add, subtract, multiply, divide, modulo, power, sqrt, abs)Specifies which mathematical operation to perform.divide

Outputs

FieldTypeDescriptionExample
resultFLOATThe computed result of the selected mathematical operation.3.0

Important Notes

  • Input ranges: a and b accept values between -1e10 and 1e10 with a step of 0.001.
  • Unary operations: sqrt and abs only use input 'a'; 'b' is ignored.
  • Division/modulo by zero: If b is 0 for divide or modulo, the node returns 0.0.
  • Square root domain: If a is negative for sqrt, the node returns 0.0.
  • Power operation: Large exponents may overflow or produce very large values; ensure inputs are within practical bounds.
  • Unknown operation: If an unsupported operation is provided, the node returns 0.0.
  • Category: SALT/Utility/Math

Troubleshooting

  • Result is 0.0 unexpectedly: Check if you attempted division/modulo by zero, sqrt of a negative number, or selected an invalid operation.
  • Output seems unchanged for unary operations: Remember that sqrt and abs ignore 'b' and operate only on 'a'.
  • Operation selection not available: Ensure the operation value is one of the allowed options: add, subtract, multiply, divide, modulo, power, sqrt, abs.
  • Precision issues: Floating-point arithmetic can introduce rounding errors; consider rounding downstream if exact decimal representation is needed.