ComfyUI Node

Float Maximum

Floor a float value in ComfyUI

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

    JWFloatMax returns the larger of two floats. Practically, that makes it a floor: wire your value into a and a minimum into b, and the output can never dip below that minimum. It's the safety net for "this number must stay at least X."

    You want this whenever a computed value could go too low and cause trouble. A denoise that accidentally lands at 0 does nothing; clamp it up to at least 0.1 with JWFloatMax. A strength that goes negative after some subtraction; floor it at 0 so it can't invert the effect. A resize factor that must stay above some threshold or the image collapses. Rather than trust the upstream math to behave, you pin the low end and move on.

    What it actually does

    Output is max(a, b) - whichever float is bigger. Both inputs are FLOAT, both default to 0, and the bounds are so wide (±1e17) you can ignore them. If a is 0.3 and b is 0.1, you get 0.3. If a drops to -0.2, you still get 0.1. The larger value wins, so b behaves as a floor.

    Its opposite is JWFloatMin, which returns the smaller value and gives you a ceiling. Put the two together - max to set a floor, min to set a ceiling - and you've hand-built a clamp that keeps any value inside a range, using two nodes and no dependencies.

    The inputs and outputs that matter

    Two required inputs, one output:

    • a - your value (FLOAT).
    • b - the other value; usually your floor (FLOAT).

    Output: one FLOAT, the larger of the two. The inputs are interchangeable as far as the node's concerned - it just returns the max - so which one is "the floor" is a convention you keep in your head.

    How to install it

    The pack is jamesWalker55/comfyui-various. ComfyUI Manager: search Various ComfyUI Nodes by Type, install, restart. Manual route:

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

    then restart. No extra packages. And if you don't want the whole pack, the author's recommended move is to grab a single file - all the Float and Integer nodes are in comfyui_primitive_ops.py, so that one file gives you the arithmetic without the rest.

    Common issues & troubleshooting

    Max is a floor, min is a ceiling - the naming trips people up. To keep a value from going too low, you use the maximum node. Taking the max of your value and a limit means the result can't fall below that limit. If your floor isn't holding, you probably wanted JWFloatMin instead.

    Zero default. An untouched JWFloatMax outputs 0. If it's stubbornly returning 0, check that a is actually wired to something and b is set to your intended floor.

    CategoryjamesWalker55

    Inputs (2)

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

    Outputs (1)

    NameTypeDescription
    FLOATFLOAT