Number Compare
The if-statement your workflow was missing
- result
- result_text
ComfyUI is a graph, not a programming language, but sometimes you still need an if. Number Compare is the closest thing to that for numbers: it takes two values, asks "is A greater than B?" (or any of five other questions), and hands you back a true/false you can wire into a switch. It's the backbone of workflows that branch - "if the seed is below 1000, do the cheap pass; otherwise do the full one."
It's part of DebugPadawan's ComfyUI Essentials, a lightweight, pure-Python utility pack. This is a logic node: zero GPU work, zero models, nothing but a comparison operator wrapped in a box.
How it works
Three required inputs:
a- first value (FLOAT, default 0)b- second value (FLOAT, default 0)comparison- a dropdown with six modes:equal,not equal,greater,less,greater or equal,less or equal
Two outputs:
result- a BOOLEAN (True/False)result_text- the same answer as the string "True" or "False"
The interesting implementation detail is that equal and not equal don't use raw ==. Floats are messy - 0.1 + 0.2 isn't exactly 0.3 - so the node compares with a 1e-9 tolerance (abs(a - b) < 1e-9). That's a thoughtful touch, because exact float equality is how you get "it should be equal but it isn't" bugs. The other four modes are plain <, >, <=, >=.
How to use it in a real workflow
The result BOOLEAN is the thing that matters. Wire it into:
- A conditional string / switch node (the same pack has
Conditional StringandLogic Gate) to pick different prompts, strengths, or paths. - A gate that only runs part of the graph when a value crosses a threshold.
- A loop control where a counter needs to know when to stop.
A very practical setup: pair it with the pack's Random Number Gen - roll a number, compare it against a threshold, and route the workflow down one of two branches. That gives you percentage-based randomness with the seed still controlling everything, so it stays reproducible.
Installing it
Install the pack once - ComfyUI Manager, searching for "DebugPadawans-ComfyUI-Essentials," or:
cd ComfyUI/custom_nodes
git clone https://github.com/DebugPadawan/DebugPadawans-ComfyUI-Essentials
Then restart ComfyUI. Requirements are just numpy, torch, and opencv-python, which a stock ComfyUI already has; there are no model files. Watch the name: this is DebugPadawan's ComfyUI Essentials, not cubiq's "ComfyUI Essentials" (which is in maintenance mode) - easy to confuse when you're searching Manager.
Gotchas
- FLOAT only. The inputs are floats, so if you're comparing two integers from separate nodes, they'll still work (ints coerce to float), but the output is always a BOOLEAN.
- Tolerance applies only to equal/not equal. "Greater" and "less" are strict, exact comparisons. Values that differ by 0.0000001 count as equal but also as "greater" if A is genuinely bigger.
- The pack is small and barely discussed in the community, so don't expect a body of forum wisdom for it - but for a node this simple, you rarely need any.
Inputs (3)
| Name | Type | Default | Description |
|---|---|---|---|
| a | FLOAT | 0.00 | — |
| b | FLOAT | 0.00 | — |
| comparison | COMBO | 6 options: equal, not equal, greater, less, greater or equal, less or equal |
Outputs (2)
| Name | Type | Description |
|---|---|---|
| result | BOOLEAN | — |
| result_text | STRING | — |