Skip to content

Comparison Operation

Performs numeric comparisons and related utilities between two numbers. It can compute min/max, clamp a value to a range, or evaluate relational checks (equal, greater/less and their inclusive variants). Outputs both a numeric result and a boolean flag indicating the outcome for comparison operations.
Preview

Usage

Use this node when you need to compare two numeric values or constrain a value within bounds as part of a workflow. Typical patterns include branching logic based on greater/less checks, gating downstream operations using the boolean output, or normalizing values via clamping before further processing.

Inputs

FieldRequiredTypeDescriptionExample
aTrueFLOATFirst numeric input to compare or clamp.3.5
bTrueFLOATSecond numeric input used for comparisons or as the counterpart for min/max operations.5.0
operationTrueSTRINGOperation to perform. One of: min, max, clamp, equal, greater, less, greater_equal, less_equal.greater_equal
clamp_minTrueFLOATLower bound used when operation is clamp. Ignored for other operations.0.0
clamp_maxTrueFLOATUpper bound used when operation is clamp. Ignored for other operations.1.0

Outputs

FieldTypeDescriptionExample
resultFLOATNumeric result of the selected operation. For min/max: the min or max of a and b. For clamp: a constrained to [clamp_min, clamp_max]. For comparisons: returns a if the comparison is true, otherwise 0.0.3.5
comparison_resultBOOLEANBoolean outcome for comparison operations: true if the relation holds, false otherwise. For min, max, and clamp, this is always false.True

Important Notes

  • Min, max, and clamp always output comparison_result as false; use comparison operations if you need a boolean for branching.
  • Equal uses a small tolerance for float comparison (approximately 1e-9), which helps avoid false negatives from floating-point precision.
  • Clamp uses max(clamp_min, min(a, clamp_max)); ensure clamp_min is less than or equal to clamp_max for meaningful results.
  • Input ranges are from approximately -1e10 to 1e10 with step granularity around 0.001.

Troubleshooting

  • Unexpected clamp result: Verify clamp_min <= clamp_max; reversed bounds can produce a value outside the intended range.
  • Equality check failing due to precision: If values are nearly equal but comparison_result is false, consider numerical precision and that the tolerance is about 1e-9.
  • comparison_result is always false: This is expected for min, max, and clamp. Use greater/less/equal variants if you need a boolean.
  • result is 0.0 for a true comparison expected: For comparison operations, result returns a only when the comparison is true; if you expected b or another value, adjust downstream logic accordingly.