ComfyUI Node

power

Powers, roots, and reciprocals in one node

By StableLlama·Created about a year ago·Updated about 15 hours ago· 48
power
    • FLOAT
    base1.00
    exponent1.00

    power (Basic data handling: FloatPower) raises one float to the power of another - base ** exponent in Python - and it's more flexible than it looks, because that single operation quietly covers three different math moves:

    • Integer exponents - 2 ** 38.0. Classic.
    • Fractional exponents - 16 ** 0.54.0. That's a square root wearing a costume; 0.333... gets you cube roots.
    • Negative exponents - 4 ** -10.25. A reciprocal, i.e. 1 / 4, without a division node.

    Two required inputs, base and exponent (both FLOAT, defaulting to 1), one FLOAT output.

    When it earns its place

    The fun use cases are the non-obvious ones. Want a "square root of the width" or a curve that falls off with the square of distance? That's power. Want to apply a gamma-style curve to a 0–1 strength value - say, to bias denoise toward low or high? Raise it to a constant exponent and watch the distribution shift. Exponent math is how you get nonlinear control out of a linear value, and this is the node that does it without making you reach for a formula.

    Like the rest of this pack's arithmetic, it's a single-operation node. If you're building a real expression - (a ** 2) / (b + 1) - chain a few of these and it gets ugly fast; MathFormula is the escape hatch for that.

    Installing it

    Part of the Basic data handling pack by StableLlama. ComfyUI Manager → search "Basic data handling" → install → restart. Manual:

    cd ComfyUI/custom_nodes
    git clone https://github.com/StableLlama/ComfyUI-basic_data_handling
    

    then restart. No dependencies, no requirements.txt, no model files.

    Troubleshooting

    A couple of edge cases are worth naming so they don't surprise you. A negative base with a fractional exponent (like (-2) ** 0.5) is mathematically imaginary, and Python will hand you a complex number - which then won't plug cleanly into anything expecting a plain float. And 0 ** 0 evaluates to 1.0 in Python, which is a convention, not a proof - fine for a workflow, just don't build expectations on it. Both cases are rare in practice, but they're the kind of thing that sends you on a 40-minute goose chase if you hit them blind.

    CategoryBasic/FLOAT

    Inputs (2)

    NameTypeDefaultDescription
    baseFLOAT1.00
    exponentFLOAT1.00

    Outputs (1)

    NameTypeDescription
    FLOATFLOAT