Skip to content

Comparison Operation

Performs common numeric comparisons and range clamping between two float values. It returns a numeric result (e.g., min/max/clamped value or the left operand when a comparison is true) and a boolean indicating the outcome of comparison-type operations. Non-comparison operations set the boolean to false.
Preview

Usage

Use this node when you need to compare two numbers (e.g., thresholds, gating, branching) or constrain a value within bounds. Typical workflows include selecting the smaller/larger of two values, clamping a value to a range, or testing conditions like equal/greater/less to drive logic downstream via the boolean output.

Inputs

FieldRequiredTypeDescriptionExample
aTrueFLOATFirst numeric value to compare or clamp. For comparison operations, this is the left-hand operand.5.0
bTrueFLOATSecond numeric value for comparison against 'a'. Ignored when operation is 'clamp'.3.0
operationTrueENUMSelects the operation to perform. Options: min, max, clamp, equal, greater, less, greater_equal, less_equal.greater
clamp_minTrueFLOATLower bound used only when operation is 'clamp'.0.0
clamp_maxTrueFLOATUpper bound used only when operation is 'clamp'.1.0

Outputs

FieldTypeDescriptionExample
resultFLOATNumeric outcome. For min/max: the min or max of a and b. For clamp: 'a' clamped to [clamp_min, clamp_max]. For comparisons (equal/greater/less/greater_equal/less_equal): returns 'a' if the comparison is true, otherwise 0.0.5.0
comparison_resultBOOLEANBoolean outcome of comparison-type operations. True if the comparison condition is met. For non-comparison operations (min, max, clamp), this is always False.true

Important Notes

  • For 'equal', floating-point equality uses a small tolerance (~1e-9) to account for precision errors.
  • When operation is 'clamp', the 'b' input is ignored; only 'a', 'clamp_min', and 'clamp_max' are used.
  • Ensure clamp_min is less than or equal to clamp_max to get meaningful clamping behavior.
  • Non-comparison operations (min, max, clamp) always output comparison_result = False.
  • All numeric inputs accept large ranges (approximately -1e10 to 1e10) and step granularity around 0.001.

Troubleshooting

  • Unexpected False on 'equal': Floating-point precision may prevent exact equality; adjust inputs or account for the 1e-9 tolerance.
  • Clamp not behaving as expected: Verify clamp_min <= clamp_max and confirm that the selected operation is 'clamp'.
  • comparison_result is always False: This is expected for 'min', 'max', and 'clamp'; use comparison operations to drive booleans.
  • Result is 0.0 on a comparison: This means the condition evaluated to False; check 'a' and 'b' values and the chosen operator.