Skip to content

Comparison Operation

Performs numeric comparisons and basic bound operations between two values. Supports min/max selection, clamping, and relational checks with a small float tolerance for equality. Returns both a numeric result and a boolean flag indicating the outcome for comparison modes.
Preview

Usage

Use this node when you need to compare two numeric values, select a minimum/maximum, clamp a value within bounds, or branch logic based on relational conditions. It commonly precedes conditional routing, thresholding, or normalization steps where a numeric pass-through and a boolean decision are both useful.

Inputs

FieldRequiredTypeDescriptionExample
aTrueFLOATFirst numeric input used for comparison or clamping.0.75
bTrueFLOATSecond numeric input used for comparison against 'a'. Not used for clamp operation.0.5
operationTrueENUMSelect the operation to perform: min, max, clamp, equal, greater, less, greater_equal, less_equal.greater_equal
clamp_minTrueFLOATLower bound for clamping when operation is 'clamp'. Ignored for other operations.0.0
clamp_maxTrueFLOATUpper bound for clamping when operation is 'clamp'. Ignored for other operations.1.0

Outputs

FieldTypeDescriptionExample
resultFLOATNumeric result of the operation. For min/max: the selected value. For clamp: the clamped 'a'. For comparisons: returns 'a' if the condition is true, else 0.0.0.75
comparison_resultBOOLEANBoolean outcome of the comparison. For min/max/clamp, this is always false; for relational operations it reflects whether the condition holds.true

Important Notes

  • Equality tolerance: 'equal' uses a small tolerance (approximately 1e-9) to account for floating-point precision.
  • Comparison outputs: For 'equal', 'greater', 'less', 'greater_equal', and 'less_equal', the float result is 'a' when true, otherwise 0.0.
  • Non-comparison modes: For 'min', 'max', and 'clamp', the boolean output is always false.
  • Clamp behavior: Clamping is performed as max(clamp_min, min(a, clamp_max)). Ensure clamp_min <= clamp_max.
  • Input ranges: Inputs are constrained internally to roughly [-1e10, 1e10] with a step of 0.001.
  • Error handling: On invalid operation or processing errors, the node returns result=0.0 and comparison_result=false.

Troubleshooting

  • Unexpected false on 'equal': Slight float differences may fail equality. Consider the tolerance (≈1e-9) or adjust upstream rounding.
  • Clamp not working as expected: Verify that 'operation' is set to 'clamp' and that clamp_min <= clamp_max.
  • Zero result on true comparison expected: Remember that for comparisons the numeric 'result' returns 'a' when true and 0.0 when false; check the boolean output for the actual condition.
  • Outputs always false: Min/max/clamp operations always output false for the boolean field by design; switch to a relational operation if you need a boolean condition.
  • Out-of-range inputs: Values far outside [-1e10, 1e10] may be clamped by input constraints; normalize inputs upstream if needed.