Nodes/comfyui-mdsnodes/Float Switch (2 decimal)
ComfyUI Node

Float Switch (2 decimal)

Pick a number with a checkbox, no rerouting required

By MarwanDSAI·Created 2 months ago·Updated about 22 hours ago· 3
Float Switch (2 decimal)
    • FLOAT
    ◄switchtrue►
    ◄true_switch_float1.00►
    ◄false_switch_float0.00►

    Two values, one boolean, one output. It's the simplest class of node in ComfyUI and the one you'll end up using in every workflow that has an "A or B" decision in it.

    What it's for

    ComfyUI's A/B switch pattern is the manual routing valve: a selector, two inputs, whichever one the selector points at comes out. Do it with models and you can keep two loaders alive and flip between them without duplicating the back half of the graph. Do it with a float and you get this node.

    Concretely: a hires-fix pass where you want denoise 0.35 on a soft upscale and 0.55 on a sharp one. A CFG you leave at a sane value normally and drop to 1.0 when a distilled model is loaded. A strength that depends on whether you remembered to add the ControlNet. Each of those is a boolean you already have - often from Is Empty in the same pack, or from a Get Value (Global) boolean - and a pair of candidate numbers.

    The value of doing it in-node instead of with two Primitive Float nodes and a separate switch: your graph doesn't grow two nodes and four wires for every A/B decision. At four decisions that's eight nodes you didn't place.

    How it works

    Three required inputs, all widgets on the node itself:

    • switch - a real BOOLEAN checkbox, default on. The author's tooltip: "True outputs the First Float, False outputs the Second Float."
    • true_switch_float - default 1.0, step 0.01.
    • false_switch_float - default 0.0, step 0.01.

    One output, FLOAT ("the selected float"). The code is a conditional expression and a cast - genuinely one line - so there is no hidden rounding, no clamping beyond the very wide float bounds, and no state.

    The honest limitation, and it matters more than the feature: the two candidate floats are typed into the node. They aren't sockets, so you can't wire a computed value in. If either branch needs to be dynamic, this node is the wrong tool and you want a switch with real input sockets. The 2-decimal in the display name describes the widget's step, not a rounding operation - the node returns exactly what you typed.

    Installing it

    ComfyUI-MDSNodes by MarwanDSAI. ComfyUI Manager: search ComfyUI-MDSNodes or MDSNodes, install, restart. Manually:

    cd ComfyUI/custom_nodes
    git clone https://github.com/MarwanDSAI/comfyui-mdsnodes
    # restart ComfyUI
    

    Nothing to pip install and no models to fetch - the repo's requirements.txt is empty and the README says the pack runs on stock ComfyUI. Which fits: this is boolean arithmetic.

    Search Float Switch (2 decimal) on the canvas, or find it under MDSNodes/logic next to Is Empty and the string switches.

    Common issues

    Missing from search. The switch family landed in pack version 1.8.0 (September 2026). Update through Manager and restart; an older clone has the pack's model-hub nodes but none of these.

    You want to wire the floats in and can't. Correct - they're widgets. For a switch whose alternatives come from upstream, feed a PrimitiveFloat into a converted input on a switch node that declares sockets instead.

    The switch flipped back on reload. BOOLEAN widgets save with the workflow, so this usually means you edited a different instance of the node than the one on the active branch - worth checking when a graph has been copied around. The value in the saved JSON is the one that runs.

    Downstream rejects the wire. The output is FLOAT. If the target declares INT (some step or seed-ish fields do), run it through Round from the same pack first; ComfyUI won't let a FLOAT wire into an INT socket and will grey the connector out.

    CategoryMDSNodes/logic

    Inputs (3)

    NameTypeDefaultDescription
    switchBOOLEANtrueTrue outputs the First Float, False outputs the Second Float.
    true_switch_floatFLOAT1.00-18446744073709550000–18446744073709550000Value returned when the switch is True.
    false_switch_floatFLOAT0.00-18446744073709550000–18446744073709550000Value returned when the switch is False.

    Outputs (1)

    NameTypeDescription
    FLOATFLOATThe selected float.