Nodes/ComfyMath-NG/ChooseFloat
ComfyUI Node

ChooseFloat

Pick between two floats on a boolean — the no-drama two-way switch for CFG, denoise, and weights

By rabanti-github·Created 2 months ago·Updated 6 days ago· 0
ChooseFloat
    • FLOAT
    conditionfalse
    a0.000
    b0.000

    ChooseFloat is the float-flavored version of ComfyMath's ChooseInt, and it's the one you'll probably reach for more, because half the interesting numbers in a ComfyUI workflow are floats. condition true gives you a, false gives you b, output is a single FLOAT. No op dropdown, no modes. a if condition else b, that's the whole thing.

    Where it earns its keep is the settings that drift between runs. Take CFG scale: some checkpoints want 7, some want 3.5, and a Flux-adjacent workflow might want something entirely different. Wire your model choice into a condition and let ChooseFloat pick the right CFG automatically instead of editing a widget every time you swap checkpoints. Same pattern for denoise strength - a "detail pass?" boolean selects a high or low denoise. Or a LoRA weight that changes based on the style you're in. Once you've seen it done once, the pattern spreads everywhere.

    The wiring pattern

    The condition socket is the brain, and it expects a real BOOLEAN. The cleanest sources are comparison and test nodes - ComfyMath's FloatUnaryCondition (IsPositive, IsZero, IsFinite…) or FloatBinaryCondition (Eq, Gt, Gte, Lt, Lte). Feed one of those and the choice becomes automatic: "if my input denoise is above 0.5, use 0.3 for the second pass, otherwise 0.8." That's a genuinely useful little graph, and it's three nodes.

    The inputs are exactly the three you'd expect:

    • condition - BOOLEAN, defaults to false.
    • a - FLOAT, default 0.0, step 0.001.
    • b - FLOAT, default 0.0, step 0.001.

    The small step size on a and b is worth noting: those widgets step by 0.001, so fine-grained values like 7.413 don't get mangled when you drag them.

    Installing it

    ChooseFloat ships in ComfyMath (published as ComfyMath-NG). Use ComfyUI Manager - search "ComfyMath" - or clone by hand:

    cd ComfyUI/custom_nodes
    git clone https://github.com/rabanti-github/ComfyMath.git ComfyMath-NG
    

    Restart ComfyUI. This fork reuses the original ComfyMath's node identifiers, so disable or remove the original first - running both is a name collision. Only dependency is numpy; nothing to download.

    One honest caveat

    If your condition comes from something that's not boolean-native, remember the socket won't take a raw 0/1 float. Convert or compare first. And don't overreach: for choosing between more than two values, you want a multi-input switch, not this. But for the single binary decision it exists for, ChooseFloat is about as painless as control flow gets in ComfyUI.

    Categorymath/control

    Inputs (3)

    NameTypeDefaultDescription
    conditionBOOLEANfalse
    aFLOAT0.000
    bFLOAT0.000

    Outputs (1)

    NameTypeDescription
    FLOATFLOAT