ComfyUI Node

Power

Exponents, Squares, and the Scaling Math Nobody Wants to Do by Hand

By silveroxides·Created 2 months ago·Updated about 7 hours ago· 24
Power
  • base
  • exponent
  • MATCHTYPE

UC_MathPower raises a base number to an exponent: base ** exponent. Exponent 2 squares it, exponent 3 cubes it, and a fractional exponent gives you roots - the same math you'd otherwise be hand-typing into a formula chain and double-checking three times. It's a one-liner node that quietly powers some of the scaling logic you'll meet in resolution and sampling workflows.

Why you'd reach for it

The honest use cases are the geometric ones. Squaring is everywhere when areas are involved - a side length to a pixel count, a dimension to a tile area - and the inverse, a 0.5 exponent, is the same thing as a square root (though the pack also ships UC_MathSqrt if you want it readable). Beyond that, exponents show up in gamma-style corrections and non-linear strength curves, where a 2.0 or 1.5 exponent reshapes a slider's feel from linear to punchy. If you're building parametric controls, "raise this to a power to change its curve" is a move you'll use more than you expect.

How it works

A straight base ** exponent in Python. Both inputs accept int or float via the MatchType template, and the output mirrors the inputs. A couple of Python behaviors are worth knowing: an integer base with a non-negative integer exponent stays an int (2 ** 38), but a negative exponent produces a float (2 ** -10.5), and a float exponent gives a float. Also, 0 ** 0 is 1 in Python - a trivia fact that occasionally bites people, usually not in a way that matters.

The inputs that matter

  • base - the number being raised.
  • exponent - how many times to multiply it. Exponent 2 is the one beginners actually want half the time.

One output, typed to match.

Installing it

Ships in ComfyUI-UtilsCollection. ComfyUI Manager → search "ComfyUI-UtilsCollection" → Install → restart, or:

cd ComfyUI/custom_nodes
git clone https://github.com/silveroxides/ComfyUI-UtilsCollection

Restart. No models; requirements are just opencv-python and typing-extensions.

What to keep in mind

The sibling relationship is the useful map: UC_MathSqrt is power(x, 0.5) with a friendly name and a negative-input guard, and UC_MathRound is what you'll want after an exponent calculation produces a long float you're about to feed into an integer widget. And like the rest of the pack's math section, this replaces the old ComfyUI-LogicMath power node - accept the swap and uninstall LogicMath so the packs don't collide. It's a small node, but when you need a square it's nicer than a formula chain and easier to read in a shared workflow.

Categoryutils/math

Inputs (2)

NameTypeDefaultDescription
baseCOMFY_MATCHTYPE_V3
exponentCOMFY_MATCHTYPE_V3

Outputs (1)

NameTypeDescription
MATCHTYPECOMFY_MATCHTYPE_V3