Number Comparison | Basic
The general-purpose comparison that doesn't care about int or float
- a
- b
- BOOLEAN
NumberComparison ("Number Comparison | Basic") is the flexible middle child of this pack's comparison family. Where IntegerComparison insists on INT sockets and FloatComparison insists on FLOAT, this one accepts both - each of a and b takes the pack's NUMBER union type, so an integer wire and a float wire can meet in the same node. Pick one of the six operators (==, !=, <, >, <=, >=) and out comes a BOOLEAN.
The mechanism is plain Python comparison - no tolerance handling like FloatComparison, no type narrowing like IntegerComparison. It compares whatever numbers arrive and tells you the truth.
The inputs that matter
- a, b - two numbers, either INT or FLOAT each.
- operation - the comparison you want.
Why you'd reach for it
This is the one I'd grab when I don't know (or don't care) what type is flowing in. It's the least-friction option: wire it into anything numeric and it just works, which makes it the default choice for quick conditionals during prototyping. Because it swallows mixed types, it's also the one that won't reject a float when your "integer" turned out to be a float halfway through a math chain.
There's a trade to name honestly. The strictly-typed siblings catch type mistakes at the socket level - IntegerComparison refuses a float wire, which can be a helpful error. NumberComparison never refuses anything numeric, so a subtle int/float mismatch won't surface here. If your graph is stable and typed, the strict versions are arguably better; if you just want a comparison to happen, this is the one.
Installing it
Standard pack install, pure Python, no dependencies:
cd ComfyUI/custom_nodes
git clone https://github.com/akatz-ai/ComfyUI-Basic-Math
Restart ComfyUI, find it under Basic Math ➕ → Boolean as "Number Comparison | Basic". Or use ComfyUI Manager → Install Custom Nodes → search "ComfyUI-Basic-Math".
The gotchas
Two reminders. First, since there's no tolerance, == on float values that came out of calculations can fail in the floating-point way - if you're comparing computed decimals, prefer FloatComparison with a tolerance. Second, the output is a real BOOLEAN, so feed it into BooleanLogic or a switch directly; if you ever need to combine several comparisons, that's the natural next hop. And expect the | Basic suffix on the menu name - same pack convention as everything else here.
Inputs (3)
| Name | Type | Default | Description |
|---|---|---|---|
| a | INT,FLOAT | 0 | — |
| b | INT,FLOAT | 0 | — |
| operation | COMBO | 6 options: ==, !=, <, >, <=, >= |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| BOOLEAN | BOOLEAN | — |