Binary Comparison
Binary Comparison
- first
- second
- result
The arithmetic half of marco-zanella's ComfyUI-BooleanExpression pack ships six single-purpose comparison nodes: Less than, Less than or equal to, Equal to, Not equal to, Greater than or equal to, Greater than. They're all the same node wearing different hats, and Binary Comparison is the hat-rack - one node that folds all six operators into a single dropdown. If you're the kind of person who keeps one text editor theme for everything, this is your node.
How it works
Three required inputs:
first- the first number (INT or FLOAT, default 0)second- the second number (INT or FLOAT, default 0)operand- the operator, chosen from a dropdown:<,≤,=,≠,≥,>(default<)
Output is result, a BOOLEAN. The mechanism is a straightforward switch on the operand - pick one, it evaluates first < second or first ≤ second or first = second and so on. Nothing fancy under the hood, and that's the point: you get the full comparison toolkit in a single node, which means one less thing to search for in the node menu and one less socket-style to memorize.
When to reach for it
The honest trade-off is between discoverability and compactness. In a workflow you're handing to someone else, six clearly-labeled nodes ("Less than", "Greater than") read better than one node with a symbol dropdown - a colleague knows what "Greater than" means at a glance, while "≠" takes a beat. But if you're the one maintaining the graph, Binary Comparison keeps your canvas small and lets you flip an operator without deleting and re-adding nodes. Change your mind from "strictly less than" to "less than or equal to"? Just click the dropdown. That flexibility is the whole appeal.
It pairs naturally with a Conditional Branch from the same pack: result feeds straight into condition, and you can tweak the comparison operator live while watching which branch fires. Great for exploring thresholds interactively instead of hard-coding them.
Installing it
Same as every node in this pack - no models, no Python dependencies (the pack's requirements.txt is empty), pure logic. ComfyUI Manager, search ComfyUI-BooleanExpression, or:
cd ComfyUI/custom_nodes
git clone https://github.com/marco-zanella/ComfyUI-BooleanExpression.git
Restart ComfyUI, and it's under Boolean Expressions → Arithmetic Comparisons. One quirk to know before you search: the class name is BooleanExpression.ArithmenticComparison.BinaryComparison - the author typo'd "Arithmetic" as "Arithmentic" and it's baked into every class name in this subfolder. Harmless in the UI, mildly annoying in code.
Gotchas
- The dropdown is the state. Save/load cycles keep your chosen operand, but if you duplicate the node, you get a fresh default (
<). Re-check the dropdown after duplicating. - Both branches of a downstream branch still compute. As with all comparison nodes here, this just picks a value - the unselected path upstream still runs. Irrelevant for numbers.
- If you want the tooltip's exact behavior, trust it:
operandis literally "The arithmetic comparison." There's no hidden handling - what you pick is what runs.
If you only ever need one operator, the dedicated node is clearer. If you're building a workflow where you'll fiddle with the threshold semantics, Binary Comparison is the one that keeps the canvas uncluttered.
Inputs (3)
| Name | Type | Default | Description |
|---|---|---|---|
| first | INT,FLOAT | 0 | The first number. |
| second | INT,FLOAT | 0 | The second number. |
| operand | COMBO | < | The arithmetic comparison. |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| result | BOOLEAN | — |