ComfyUI Node Runs on cloud

Power

Raise a number to an exponent inside your graph

By Derfuu·Created 3 years ago·Updated 2 years ago· 455
Power
    • FLOAT
    Value1.00
    Exponent1.00

    Power is exponentiation as a node: value to the power of exponent, A^B. Square something with exponent 2, cube it with 3, take a root with a fractional exponent like 0.5. On its own it's the least glamorous node imaginable, but it's part of the reason Derfuu's pack exists - before ComfyUI had decent native math, this is how you did arithmetic on dimensions and parameters without leaving the graph.

    How it works

    It computes Value raised to Exponent and outputs the result as a float. Both inputs are floats, so fractional exponents work: exponent 0.5 gives you a square root, 2 gives you a square, -1 gives you the reciprocal. If you specifically want a square root, Derfuu ships a dedicated Square root node, but Power is the general form.

    The inputs and outputs that matter

    • Value (FLOAT, default 1) - the base.
    • Exponent (FLOAT, default 1) - the power to raise it to. Exponent 1 is a pass-through; that's the default, so a freshly dropped node does nothing until you change it.
    • Output: FLOAT - the result, wired into the next math node or a consumer.

    Where it fits

    The math nodes in this pack are meant to be chained. A typical use is scaling something nonlinearly - say you want a value that grows faster than linearly as another input rises, so you raise it to a power before feeding it into a size or strength. Combined with Multiply, Divide, and the size-getter nodes, Power lets you build a small formula that computes dimensions or weights off a single driver value. Follow it with Ceil, Floor, or Integer when the result needs to be a whole number.

    How to install it

    ComfyUI Manager: search Derfuu_ComfyUI_ModdedNodes, install, restart. By hand:

    cd ComfyUI/custom_nodes
    git clone https://github.com/Derfuu/Derfuu_ComfyUI_ModdedNodes
    

    then restart. No requirements.txt, no models - plain Python.

    Common issues & troubleshooting

    The output looks wrong for a "root." Roots are fractional exponents. A square root is exponent 0.5, a cube root is 1/3 ≈ 0.333. If you typed 2 expecting a root, you got a square instead.

    Negative base with a fractional exponent misbehaves. Raising a negative number to something like 0.5 isn't a real number, and you'll get NaN or an error depending on how it's handled. Run the base through Absolute value first if it might be negative.

    You didn't want a float. The output is FLOAT. Convert with Ceil, Floor, or Integer if the consumer wants an INT.

    The node is red in an old workflow. Derfuu has deleted deprecated nodes on updates rather than keeping them labeled, so an inherited graph can point at a name that no longer exists - drop in a fresh copy. A ModuleNotFoundError mentioning Derfuu_ComfyUI_ModdedNodes_legacy means a duplicated folder; keep one, named Derfuu_ComfyUI_ModdedNodes. And for a new graph, remember native and third-party math nodes are common now - you don't need Derfuu unless a workflow already depends on it.

    CategoryDerfuu_Nodes/Math

    Inputs (2)

    NameTypeDefaultDescription
    ValueFLOAT1.00
    ExponentFLOAT1.00

    Outputs (1)

    NameTypeDescription
    FLOATFLOAT