ComfyUI Node

Compare

Turning a Comparison Into a Yes or No

By silveroxides·Created 2 months ago·Updated about 7 hours ago· 24
Compare
  • value_a
  • value_b
  • result
comparisonEqual

ComfyUI is a programming language with no keyboard, and UC_MathCompare is the if statement. It takes two numbers, applies the rule you pick, and returns a clean true/false that you can feed straight into logic nodes to make your workflow actually decide things.

Why you'd reach for it

The instant you want a workflow that behaves differently depending on a value, you need a comparison feeding a branch. Classic example: a batch size computed from VRAM, and you want a different upscale path when it's above 1024. Or a resolution that must not exceed a limit - compare against the limit, and route through a clamp or an alternative branch when it's too big. Combined with the pack's UC_LogicIF, a comparison turns a static graph into something that reacts, which is the difference between a linear pipeline and a real workflow.

How it works

Two inputs, value_a and value_b, both accepting int or float. Then comparison, a dropdown with six rules: Equal, Not Equal, Greater Than, Less Than, Greater Than or Equal, and Less Than or Equal. The node applies the selected rule and emits a BOOLEAN output named result. That boolean is the currency of logic nodes - wire it into an IF or a switch and you're routing data based on the answer. It accepts int or float on both sides, so comparing a float from a slider against an int threshold just works, no conversion.

The inputs that matter

  • value_a and value_b - the two numbers.
  • comparison - the rule, defaulting to Equal. This is the one you'll actually fiddle with.

That's the whole node: a boolean out, ready to gate, route, or toggle.

Installing it

It's in ComfyUI-UtilsCollection by silveroxides. ComfyUI Manager → search "ComfyUI-UtilsCollection" → Install → restart, or:

cd ComfyUI/custom_nodes
git clone https://github.com/silveroxides/ComfyUI-UtilsCollection

Restart. Light deps (opencv-python, typing-extensions), no model downloads for the math family.

Where people get tripped up

The recurring gotcha is expecting a comparison to do something on its own. It doesn't - it only produces the true/false. If nothing happens downstream, the node isn't broken; you've just got no logic node consuming it. Pair it with UC_LogicIF or any switch and the graph comes alive. Also worth knowing: this is a drop-in replacement for the old ComfyUI-LogicMath compare node, so if you migrated and ComfyUI asked about swapping nodes, accept it and remove LogicMath to avoid duplicates. For "is this too big / too small / exactly that," there's no simpler way to ask.

Categoryutils/math

Inputs (3)

NameTypeDefaultDescription
value_aCOMFY_MATCHTYPE_V3
value_bCOMFY_MATCHTYPE_V3
comparisonCOMBOEqual6 options: Equal, Not Equal, Greater Than, Less Than, Greater Than or Equal, Less Than or Equal

Outputs (1)

NameTypeDescription
resultBOOLEAN