ComfyUI Node

Float Minimum

Clamp a float to a ceiling in ComfyUI

By jamesWalker55·Created 3 years ago·Updated about a year ago· 215
Float Minimum
    • FLOAT
    a0.00
    b0.00

    JWFloatMin returns the smaller of two floats. That sounds trivial until you realize what it's actually for: capping a value. Feed it your computed number as a and a ceiling as b, and the output can never exceed that ceiling. It's a guardrail you can wire in.

    This is the node you reach for when some upstream calculation might overshoot. Say you're computing a denoise strength from a couple of other values and you never want it to go above 0.8 - run it through JWFloatMin with b = 0.8 and you're covered no matter what the math produces. Same idea for capping a resize factor, a CFG, or any parameter that gets ugly past a certain point. Instead of hoping the number stays in range, you enforce it.

    What it actually does

    It outputs min(a, b) - whichever of the two floats is smaller. Both are FLOAT, both default to 0, and the range is effectively unbounded (±1e17). If a is 0.6 and b is 0.8, you get 0.6. If a climbs to 0.95, you still only get 0.8. That asymmetry is the point: b acts as the cap.

    Its mirror twin is JWFloatMax, which returns the larger of two values and gives you a floor instead of a ceiling. Chain min after max (or vice versa) and you've built a clamp - a value pinned between a floor and a ceiling - out of two tiny nodes.

    The inputs and outputs that matter

    Two required inputs, one output:

    • a - your value (FLOAT).
    • b - the other value; in practice, your ceiling (FLOAT).

    Output: a single FLOAT equal to the smaller of the two. The two inputs are symmetric - the node doesn't care which is "the cap," it just returns the minimum - so it's on you to remember which wire is which.

    How to install it

    Pack is jamesWalker55/comfyui-various. ComfyUI Manager: search Various ComfyUI Nodes by Type, install, restart. Or:

    cd ComfyUI/custom_nodes
    git clone https://github.com/jamesWalker55/comfyui-various
    

    then restart. No dependencies. As with the rest of the math set, you can skip the full clone and just drop comfyui_primitive_ops.py into custom_nodes/ - that single file carries every Float and Integer node, and nothing else.

    Common issues & troubleshooting

    Min gives you a ceiling, max gives you a floor - and people mix them up constantly. It's counterintuitive: to cap a value you use the minimum node. Say it slowly: taking the min of your value and a limit means the result can never rise above that limit. If your clamp is doing the opposite of what you wanted, you've grabbed the wrong twin - swap to JWFloatMax.

    Both default to 0. An untouched JWFloatMin outputs 0, because min(0, 0) is 0. If it's stuck at zero, one of your inputs never got wired or set.

    CategoryjamesWalker55

    Inputs (2)

    NameTypeDefaultDescription
    aFLOAT0.00-100000000000000000–100000000000000000
    bFLOAT0.00-100000000000000000–100000000000000000

    Outputs (1)

    NameTypeDescription
    FLOATFLOAT