ComfyUI Node

Clamp Float

Keep a number where it belongs

By mickmumpitz·Created 8 months ago·Updated 9 days ago· 47
Clamp Float
    • value
    value0.00
    min0.00
    max1.00

    Sometimes the most useful node in a graph is the boring one. ClampFloat takes a float and squeezes it into a range: below the min becomes the min, above the max becomes the max, anything in between passes through. That's the entire job. No model loading, no vision, no downloads. You wire it into a chain of values and it quietly prevents a number from going somewhere it shouldn't.

    Where you'll actually feel it: when a math node, a seed-derived value, or a LoRA-weight slider produces something out of bounds and the node downstream is strict about its range. Strength values, CFG scales, denoise values, any 0..1-or-bust parameter. ClampFloat is the safety net between "a computed value" and "a value a node will accept."

    How it works

    Three inputs:

    • value - the number to clamp.
    • min - floor. Default 0.
    • max - ceiling. Default 1.

    One output, value (a FLOAT). Two nice details from the source: it handles min > max by swapping them instead of erroring - so a mis-wired range still does something sane - and it uses the same clamp on both ends. It also takes any float precision, so you can clamp a 0.8733… whatever into [0, 1] without rounding it.

    Honestly, that's the whole feature list. The power is compositional: ClampFloat upstream of a picker or a switch means the value downstream is guaranteed in range, which makes the rest of the graph easier to reason about.

    Where it fits

    This one lives in the Utils category of the pack, alongside the resolution pickers and gates. It's the kind of node that looks trivial and then shows up in every workflow once you know it exists - the graph-version of defensive programming. Use it wherever a value crosses a boundary between nodes with different ideas about what's valid.

    Installing it

    Part of Mickmumpitz-Nodes:

    cd ComfyUI/custom_nodes
    git clone https://github.com/mickmumpitz/ComfyUI-Mickmumpitz-Nodes.git
    

    or ComfyUI Manager → search "Mickmumpitz" → install → restart. No dependencies beyond what the pack already needs (numpy, Pillow, opencv-python), and nothing to download.

    Troubleshooting

    • Value doesn't change - it's in range. That's success, not a bug.
    • Clamping wrong direction - double-check min and max; the swap-when-inverted behavior means a flipped pair still works, just with your intent inverted.
    • Need it on an INT instead - this is float-only. Pipe the output through whatever converts to int, or reach for a different node.
    • "This is trivial, why does it exist?" - fair. But next time a sampler rejects a 1.3 denoise, you'll remember it.
    CategoryMickmumpitz/Utils

    Inputs (3)

    NameTypeDefaultDescription
    valueFLOAT0.00-1000000000–1000000000
    minFLOAT0.00-1000000000–1000000000
    maxFLOAT1.00-1000000000–1000000000

    Outputs (1)

    NameTypeDescription
    valueFLOAT