Nodes/ComfyUI-JakeUpgrade/Float Binary Condition JK๐Ÿ‰
ComfyUI Node

Float Binary Condition JK๐Ÿ‰

Compare two floats without the 'is it exactly equal' trap

By jakechaiยทCreated 2 years agoยทUpdated 3 months agoยท 147
Float Binary Condition JK๐Ÿ‰
    • BOOLEAN
    โ—„opโ–พโ–บ
    โ—„a0.00โ–บ
    โ—„b0.00โ–บ

    CM_FloatBinaryCondition compares two floats, a and b, and returns a BOOLEAN for the chosen comparison: Eq, Neq, Gt (>), Gte (โ‰ฅ), Lt (<), Lte (โ‰ค). Six operators, two floats, one yes/no - it's the node that turns "how much" into "should we."

    Where it shows up

    Float comparisons are everywhere once you start gating generation on metrics:

    • Strength thresholds. "Only run the refine if the detail pass reached strength 0.6" - compare a computed strength against a constant.
    • Confidence gates. A detector's confidence crossing a cutoff before a branch fires.
    • Percent windows. "While denoising progress is <= 0.5, do the composition path" - compare a sigmas value against a boundary.
    • Range checks. Two conditions plus a Bool AND gate build "a is between X and Y," which is how you clamp behavior without a dedicated range node.

    Feed the boolean into the pack's Bool gates, a switch, or any node with a boolean input, and you've got control flow.

    The one real trap: Eq on floats

    Exact float equality is a lie. 0.1 + 0.2 is not 0.3 in binary floating point, and anything your graph computes almost certainly isn't exactly the value you typed. Eq will say false for values that look identical. For computed values, use Gte/Lte with a small tolerance - e.g. "a >= 0.99 and a <= 1.01" for "about one." Eq is only safe when at least one side is a value you know is bit-exact (a literal you typed into a constant).

    Installing it

    Part of ComfyUI-JakeUpgrade:

    cd ComfyUI/custom_nodes
    git clone https://github.com/jakechai/ComfyUI-JakeUpgrade
    cd ComfyUI-JakeUpgrade
    # Windows standalone: install.bat
    # or: python_embeded\python.exe -s -m pip install -r requirements.txt
    pip install -r requirements.txt   # non-Windows
    

    Or ComfyUI Manager, search "JakeUpgrade", install, restart.

    Gotchas

    • Never use Eq on the output of math. Tolerance ranges beat exact equality for any computed float.
    • Gt vs Gte again - boundary values behave differently; decide whether the boundary itself passes before wiring.
    • Manager's JakeUpgrade / IPAdapter_plus conflict warning is a false positive from the pack's replacement/ folder.
    • ComfyUI-MultiGPU causes CUDA errors with recent ComfyUI - disable it per the README.
    Category๐Ÿ‰ JK/โœ–๏ธ Math/๐Ÿฅ Float

    Inputs (3)

    NameTypeDefaultDescription
    opCOMBOSelect comparison operation
    aFLOAT0.00First float input
    bFLOAT0.00Second float input

    Outputs (1)

    NameTypeDescription
    BOOLEANBOOLEANโ€”