Power
Raise any number to any exponent, no Python required
- base
- exponent
- MATCHTYPE
Power is the exponentiation node: two inputs, base and exponent, and the output is base raised to the exponent. 2 to the 3 gives 8. That's the whole node, and it's one of those quiet utilities that only earns its place when you actually need an exponent in the middle of a graph and realize core ComfyUI gives you no clean way to do it.
Where does that come up? Area and scale math, mostly. Doubling a resolution quadruples the pixels, and that kind of squared/scaled relationship appears whenever you're computing image areas, batch memory estimates, or upscale factors. It's also the natural way to express growth curves - "this step weight should scale with the square of the iteration" - and fractional exponents (roots, via 0.5) work too, though the pack has a dedicated Square Root node if that's the shape you need.
How it works
It's Python's ** operator wrapped in a node, executed directly: base ** exponent. Both inputs accept ints or floats through the type template, and the output type follows the inputs. Feed two ints and you get an int (2 ** 3 → 8); feed a float and the result goes float.
No validation, no clamping, no state. If you exponent something to an absurd number, you get an absurd number - Power won't save you from yourself, so keep exponents sane unless you genuinely want runaway values. The node just computes and returns, which is exactly what you want from a math utility sitting mid-graph.
The inputs that matter
base- the number being raised.exponent- the power to raise it to. Positive, negative, integer, or fractional all work.
Output is the result as a MATCHTYPE number. Wire it anywhere a computed number belongs - resolution calculators, scaling factors, strength computations.
Install
This node ships in the ComfyUI-LogicMath pack. Install via ComfyUI Manager (search "ComfyUI-LogicMath", Install, restart) or:
cd ComfyUI/custom_nodes
git clone https://github.com/silveroxides/ComfyUI-LogicMath
No pip dependencies, no model downloads. The pack targets ComfyUI's newer extension API, so update ComfyUI if the node doesn't show up after install.
Common issues
- Huge or surprising outputs - that's exponentiation doing its job. Double-check the exponent value;
2 ** 10is 1024, and it only grows from there. - Float results when you expected ints - a float on either input makes the whole thing float. Keep both inputs int if you want an int back.
If you never need an exponent, you'll never touch this node, and that's fine. But the day a workflow hands you a "scale by the square of X" problem, this is the ten-second fix.
Inputs (2)
| Name | Type | Default | Description |
|---|---|---|---|
| base | COMFY_MATCHTYPE_V3 | — | |
| exponent | COMFY_MATCHTYPE_V3 | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| MATCHTYPE | COMFY_MATCHTYPE_V3 | — |