Nodes/ComfyMath/IntBinaryCondition
ComfyUI Node

IntBinaryCondition

Compare two integers and get a boolean back

By evanspearman·Created 3 years ago·Updated about a year ago· 192
IntBinaryCondition
    • BOOL
    op
    a0
    b0

    This is the node you reach for when you need to compare two whole numbers and branch on the answer - is this batch index greater than that threshold, does this seed match that one, has a counter hit its limit. IntBinaryCondition takes two integers, applies a comparison, and outputs true or false. It's one of the logic nodes in ComfyMath, evanspearman's utility pack that fills in the boolean-and-arithmetic gap ComfyUI's core doesn't cover.

    How it works

    Feed it a and b, both integers, pick an op - Eq, Neq, Gt, Lt, Geq, or Leq - and it evaluates a <op> b. Standard comparison-operator behavior: Eq/Neq for equality, Gt/Lt for strict greater/less than, Geq/Leq for the inclusive versions. There's no ambiguity here the way there is with float equality - integers compare exactly, so Eq does what you'd expect without any floating-point fuzziness to worry about.

    The typical use is driving something conditional further down the graph: an index check to decide whether the current item in a batch loop should be processed, a threshold check on a seed or step count, or a sanity check before a downstream node that would choke on an out-of-range value.

    Inputs and outputs

    • op - the comparison to run (Eq, Neq, Gt, Lt, Geq, Leq).
    • a (INT, default 0) and b (INT, default 0) - the two values being compared.
    • Output: BOOL - the result of the comparison.

    How to install it

    Through ComfyUI Manager: search ComfyMath, install, restart. Manually:

    cd ComfyUI/custom_nodes
    git clone https://github.com/evanspearman/ComfyMath.git
    

    then restart ComfyUI. It's a plain Python pack - no requirements.txt, no models to fetch, nothing that needs a GPU. The install is about as low-friction as custom nodes get.

    Common issues & troubleshooting

    The output won't wire into a switch node from another pack. Worth knowing: this node's output is BOOL, a type ComfyMath defines itself - it isn't ComfyUI's built-in BOOLEAN type. Most nodes that expect a boolean from elsewhere in the ecosystem want BOOLEAN, so a connection can silently refuse to snap into place. If you specifically need core BOOLEAN output, ComfyMath's own CM_IntToBool node produces that type instead (though it only tests for nonzero, not a general comparison) - worth checking before you assume the pack is broken.

    Workflow load complains about a missing node. Standard fix: install ComfyMath through Manager as above, then reload the workflow.

    Reload after install. A git clone into custom_nodes needs a full ComfyUI restart, not just a browser refresh, before the node shows up.

    It's a stable, mostly-frozen pack. A 2024 community thread noted evanspearman had moved on from active development on ComfyMath. That's fine for a node this simple - pure integer comparison has no external dependency to rot - but don't expect the operator list to grow; what's here is what's here.

    Categorymath/int

    Inputs (3)

    NameTypeDefaultDescription
    opCOMBO6 options: Eq, Neq, Gt, Lt, Geq, Leq
    aINT0
    bINT0

    Outputs (1)

    NameTypeDescription
    BOOLBOOL