ComfyUI Node

power

2 to the 10th, without the math node

By StableLlama·Created about a year ago·Updated a day ago· 48
power
    • INT
    base1
    exponent0

    Raising a number to a power is the operation behind every "doubling" calculation - 2^n, growth curves, resolution doubling chains - and it's the kind of thing a generic math node makes feel heavier than it is. power from the Basic data handling pack is a clean integer exponent node: base in, exponent in, integer out. If your workflow ever computes 2^x or similar, this is the node that makes it a one-liner instead of a formula-string puzzle.

    What it does

    base ** exponent, plain Python exponentiation. 2 ** 10 is 1024. 3 ** 3 is 27. Two details worth internalizing:

    • An exponent of 0 gives 1 - the default, and correct, since anything to the power of zero is one. That default means double-clicking the node gives you 1, not an error.
    • Keep exponents non-negative. Python's int ** negative-int returns a float - 2 ** -1 is 0.5 - and a float doesn't fit this node's INT output cleanly. For fractional powers, use the pack's float power node instead.

    Inputs and outputs

    • base - INT, default 1. The number being raised.
    • exponent - INT, default 0. How many times to multiply it.
    • Output INT - the result of base ** exponent.

    Install

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

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

    then restart ComfyUI. Pure Python, no dependencies, no model downloads.

    When it's the right tool

    The classic use is resolution math: a "tile until it's big enough" loop that squares dimensions, or an upscale factor computed as 2^n for N refinement passes. Pair it with IntMultiply for anything more complex than a plain power. And the growth warning: exponentiation gets big fast, and unlike fixed-width languages Python won't stop you - 10 ** 100 is a 101-digit integer that will happily flow into the next node. Great for exploration, but put a cap on it when it's feeding real parameters.

    CategoryBasic/INT

    Inputs (2)

    NameTypeDefaultDescription
    baseINT1
    exponentINT0

    Outputs (1)

    NameTypeDescription
    INTINT