M Int Pow (a ** b)
Exponent math with a sanity clamp
- a_pow_b
Exponentiation is where integer math gets dangerous, and M Int Pow is the node that takes a ** b and then puts a leash on it. Inputs a (default 2) and b (default 8), output a_pow_b - but with two deliberate safety behaviors baked in that make this node different from just typing the math.
The first is the exponent clamp: b is pinned to the range −62 to 62 before anything runs. The author's comment says it plainly - "huge exponents will explode time/size" - and they're right. 2 ** 1000 isn't a size, it's a 302-digit number that no ComfyUI socket wants. Clamping keeps the node from ever producing nonsense.
The second behavior is how negative exponents are handled. Integer a ** b with a negative b is a fraction (like 1/4 for 2 ** -2), and there's no clean integer answer, so the node returns 0 for any negative exponent. That's a design decision worth knowing - it's not a bug, it's "fractions don't fit in an INT socket, so you get zero."
Where it's genuinely useful:
- Exponential growth curves. Doubling schedules - 2, 4, 8, 16 - are powers of two, and if you're computing a size or count that scales that way, this node does it visibly.
- Resolution/step math that compounds. Any "square it" or "cube it" relationship between workflow values.
- Bounded growth. Pair the output with M Int Clamp or M Int Min when you want the curve and a hard ceiling.
Inputs are signed 32-bit INT with the defaults above. Output is a plain INT. The clamp range means you can't blow up the graph, which is the feature, not the limitation.
It ships in ComfyUiNodes (repo Madlumi/ComfyUiNodes, author "Madanie"), a small personal pack of integer math, string helpers, and workflow-glue nodes. Install via ComfyUI Manager - search "ComfyUiNodes" - or:
cd ComfyUI/custom_nodes
git clone https://github.com/Madlumi/ComfyUiNodes
Then restart ComfyUI. No pip requirements or model downloads. Find it under Add Node → mnodes → int.
If you never raise anything to a power, skip it - but the clamp and the negative-exponent behavior are the kind of thoughtfulness that says the author has actually used these nodes, and that's worth knowing when you trust the pack.
Inputs (2)
| Name | Type | Default | Description |
|---|---|---|---|
| a | INT | 2-2147483648–2147483647 | — |
| b | INT | 8-2147483648–2147483647 | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| a_pow_b | INT | — |