β Compare (Float)
A Real If-Statement for Your Workflow
- Result
ComfyUI is great at "do this, then that," but awful at "only do that if this." There's no native if - you need nodes that produce booleans and nodes that act on them. Float Compare gives you the boolean half: compare two numbers and get a true/false you can feed into conditional logic. It's a tiny node with a surprisingly big role once you start building branching workflows, and it's also the kind of thing you can't build with stock ComfyUI at all.
How it works
Three inputs, one output:
aandb- the two floats to compare (default 0 each).op- the operator, from a dropdown:GT,LT,GTE,LTE,EQUAL,NOTEQUAL. Defaults toEQUAL.Result(output) - a BOOLEAN, true when the comparison holds.
Under the hood it's exactly what it looks like: cast both to floats, apply the operator, return the boolean. GT = a > b, GTE = a >= b, NOTEQUAL = a != b. Nothing clever, nothing hidden, no epsilon tolerance - if you're comparing computed floats that can land on 2.9999999, EQUAL against 3.0 will surprise you. That's the one real caveat of float equality and it's worth keeping in mind.
The output boolean is the interesting part, because in ComfyUI a boolean on a wire can drive any number of downstream behaviors - TinyBee has Boolean to Int, the core has switches and conditionals, and you can route it into prompt builders. The classic setup: compare a metric (a width, a count, a score) against a threshold and branch the workflow on the result.
Where you'd actually use it
- Dimension guards: "if image width > 1024, downscale; else pass through."
- Batch control: "if the counter exceeds N, stop" or "if there are more than X items, split differently."
- Threshold gates: decide between upscale paths based on a computed value (TinyBee's casting family - Float to Int, Int to Float - plugs right in to build the number you're comparing).
Installing it
It's part of ComfyUI-TinyBee, in the πTinyBee/Casting category:
- ComfyUI Manager β Install Custom Nodes β search "ComfyUI-TinyBee" β Install, then restart ComfyUI.
cd ComfyUI/custom_nodes
git clone https://github.com/TinyBeeman/ComfyUI-TinyBee
Restart. No models; this is two casts and a comparison, so it doesn't touch the pack's requirements.txt (pillow, jsonata) at all.
Gotchas
Float equality is the honest trap: EQUAL on computed values is a coin flip due to floating-point rounding, so prefer GTE/LTE pairs for threshold checks. And remember this compares two numbers - if you have a string that looks like a number (e.g., from Dictionary Lookup, which returns strings), cast it first with String to Float. The same pack also ships Int Compare and String Compare, which are the same idea with different input types - pick the one that matches your data and you'll have fewer conversions in your graph.
Inputs (3)
| Name | Type | Default | Description |
|---|---|---|---|
| Action | COMBO | 6 options: ==, !=, <, >, <=, >= | |
| A | FLOAT | β | |
| B | FLOAT | β |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| Result | BOOLEAN | β |