Nodes/ComfyMath/NumberBinaryCondition
ComfyUI Node

NumberBinaryCondition

Compare two generic numbers

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

    ComfyUI's socket system is strict about types - an INT plug only fits an INT socket, a FLOAT only fits a FLOAT socket. ComfyMath works around that in its own corner by defining a generic NUMBER type that its Number* nodes share, so you can do comparisons and math without committing to int-vs-float until you actually need to. NumberBinaryCondition is the comparison node for that type: two NUMBERs in, a boolean out.

    It's part of ComfyMath, evanspearman's math/logic utility pack, and it sits next to CM_IntBinaryCondition (which does the same job but only for INT) - reach for this one instead when the values flowing through your graph could plausibly be either.

    How it works

    Feed it a and b, both NUMBER type, pick an op - Eq, Neq, Gt, Gte, Lt, Lte - and the node evaluates the comparison and returns a boolean. Functionally it's the same six standard comparisons you'd expect (equal, not-equal, greater-than, greater-or-equal, less-than, less-or-equal); the difference from the INT/FLOAT-specific condition nodes in this pack is purely about which socket type it accepts and returns.

    Inputs and outputs

    • op - the comparison to run: Eq, Neq, Gt, Gte, Lt, Lte.
    • a (NUMBER, default 0) and b (NUMBER, default 0) - the values being compared.
    • Output: BOOL - ComfyMath's own boolean type.

    How to install it

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

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

    then restart ComfyUI. No dependencies, no models - it's arithmetic in plain Python.

    Common issues & troubleshooting

    Sockets won't connect to your INT or FLOAT nodes. This is the sharpest edge of the whole NUMBER-type approach: NUMBER is not the same type as INT or FLOAT, so a wire from a core ComfyUI INT/FLOAT output usually won't snap directly into this node's a/b inputs, and this node's BOOL output won't snap into things expecting core BOOLEAN either. If you're coming from a concrete INT or FLOAT value, check whether ComfyMath's own conversion nodes (CM_NumberToInt / CM_NumberToFloat handle the outgoing direction; going the other way generally means using the INT- or FLOAT-specific condition node instead of this one).

    Not sure which "flavor" of condition node to use. If you already know your value is a concrete INT or FLOAT, use CM_IntBinaryCondition or the float equivalent - they're simpler and match core types more often. Reach for this NUMBER version specifically when a value's type isn't pinned down yet, or when you're chaining several ComfyMath Number* nodes together and don't want to keep converting between steps.

    Missing node error loading a shared workflow. Install ComfyMath through Manager as above, then reload.

    The pack looks unmaintained. It largely is - a 2024 community thread noted the author had stepped back - but it's plain math with no external dependencies, so there's little for it to break on. Treat it as a small, finished utility.

    Categorymath/float

    Inputs (3)

    NameTypeDefaultDescription
    opCOMBO6 options: Eq, Neq, Gt, Gte, Lt, Lte
    aNUMBER0
    bNUMBER0

    Outputs (1)

    NameTypeDescription
    BOOLBOOL