InnerIntMathOperation
InnerIntMathOperation – ComfyUI Node
- INT
What it is
InnerIntMathOperation is a basic integer calculator node: two integer inputs, one operator, one integer output. Nothing fancy, and that's exactly the point - it's the counter-incrementing workhorse for hand-built loops in this pack. Pair it with InnerIntCompare and InnerLoopClose and you've got the three pieces a for-each style loop needs: something to advance a counter, something to check whether to keep going, and something to carry the counter's new value into the next iteration.
How it works
Takes a, b, and an operation choice, and returns the integer result. Six operations are available: add, subtract, multiply, divide, modulo, power. The one to think about before you rely on it is divide - integer division semantics (does it truncate, floor, or round?) aren't spelled out in the schema, and if your loop logic depends on an exact division result, it's worth testing that operation in isolation once rather than assuming a particular rounding behavior.
Inputs and outputs
a(INT, default 0) - left operand. The range shown is enormous (roughly ±1.8×10^19), effectively no practical ceiling for loop-counter purposes.b(INT, default 0) - right operand, same range.operation(enum, no listed default; choices:add,subtract,multiply,divide,modulo,power) - the operation to perform.
One output, named INT (type INT) - the result.
Installing it
Comes with comfyui-easyapi-nodes. Through ComfyUI Manager: search "comfyui-easyapi-nodes", install, restart. Manual install:
cd ComfyUI/custom_nodes
git clone https://github.com/lldacing/comfyui-easyapi-nodes.git
cd comfyui-easyapi-nodes
pip install -r requirements.txt
No dependency needed for this node itself, but the requirements install is worth running so the pack's other nodes load cleanly too. git pull in the folder later to upgrade.
Common issues
"My counter isn't actually advancing between loop iterations." This node computes a new value, but it doesn't automatically feed itself back in - that carrying-forward is InnerLoopClose's job, taking the computed value as one of its initial_value slots and handing it back out as the corresponding value output for the next pass. If the math node's output isn't wired through the loop-close node's carry mechanism, you'll just get the same computation repeated on the same starting numbers every time instead of a genuinely incrementing counter.
"Divide gave me a result I didn't expect (rounding, or a crash on divide-by-zero)." Integer division by zero will error regardless of how any node implements it - guard against b being zero before that operation runs if there's any chance of it in your workflow, typically with an InnerIntCompare check upstream. For rounding behavior, test the specific operation once with known numbers before trusting it in a loop where a rounding surprise compounds every iteration.
"Power operation seems slow or the number got enormous." power on large exponents grows extremely fast - this is basic math, not a node bug, but worth remembering the range on a/b is wide enough that it's easy to accidentally request a genuinely huge number if you're not watching the values feeding in.
Inputs (3)
| Name | Type | Default | Description |
|---|---|---|---|
| a | INT | 0-18446744073709550000–18446744073709550000 | — |
| b | INT | 0-18446744073709550000–18446744073709550000 | — |
| operation | COMBO | 6 options: add, subtract, multiply, divide, modulo, power |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| INT | INT | — |