Nodes/ComfyUI-JDCN/LogicUtil_ABiggerThanB
ComfyUI Node

LogicUtil_ABiggerThanB

The 'is A bigger than B?' gate that gates your whole workflow — LogicUtil_ABiggerThanB

By daxcay·Created 2 years ago·Updated about a year ago· 159
LogicUtil_ABiggerThanB
  • input1
  • input2
  • BOOL

The one-line version

LogicUtil_ABiggerThanB answers one question - input1 > input2 - and hands you a BOOL you can wire into a switch, a gate, or an "either" node. It's the primitive every "only do this when X exceeds Y" workflow is built from: cap a resolution, stop scaling past a budget, pick a different path once a counter gets big.

It lives in the LogicUtil family inside ComfyUI-JDCN, the pack known for its folder/file utilities. LogicUtil is its logic section, credited to aria1th's ComfyUI-LogicUtils in the source.

How it works

Pure comparison, no side effects: the node returns True when input1 is greater than input2, False otherwise. The source is exactly:

return (True if input1 > input2 else False,)

Both inputs are wildcard (*) sockets, meaning they accept whatever you feed them - ints, floats, even strings if you want lexicographic comparison (though mixing types will error). It's the classic "comparator" node, useful because it turns a number comparison into a signal your graph can branch on.

Inputs and outputs

  • input1 (* / any) - the value on the "bigger" side
  • input2 (* / any) - the value on the "smaller" side
  • Output: BOOL - True if input1 > input2

Two inputs, one boolean output. In practice you'll feed it numbers from widgets or arithmetic nodes and wire the BOOL into a conditional - LogicUtil_ReturnAorBValue in the same pack is its natural partner (return A when True, B when False).

Installing it

One install for the whole pack:

Easiest - ComfyUI Manager → Install Custom Node → search ComfyUI-JDCN → install → restart.

Manual:

cd ComfyUI/custom_nodes
git clone https://github.com/daxcay/ComfyUI-JDCN.git
cd ComfyUI-JDCN
pip install -r requirements.txt

Restart ComfyUI. The pack's only dependency is piexif, and there are no model downloads.

Common issues

  • Strictly > - not >=. Equal values return False. If your workflow needs "bigger than or equal," invert the logic or compare the other way and it'll feel off. There's no >= variant in this family, so plan around strictness.
  • Mixed types. The * sockets are permissive, but Python is not: comparing a string to a number raises TypeError and the queue dies. Keep both sides the same type.
  • It only tests "bigger than." For equality or "less than," you're looking at the wrong node in this pack - but for the common "does it exceed the threshold" case, this is the one.

When you'd actually reach for it

Threshold gates: "only run the upscaler when the image is under 1MP," "switch to the turbo model once steps exceed 20," "cap this counter." Pair it with a conditional node and you've got real branching logic without touching Python. Simple, boring, and genuinely useful - which is exactly why it shows up in shared workflows you'll load.

CategoryLogicUtil

Inputs (2)

NameTypeDefaultDescription
input1*0
input2*0

Outputs (1)

NameTypeDescription
BOOLBOOL