.internal/math_int
A two-operation integer calculator, built for loop indices
- value
This is about as minimal as a node gets: two integers in, one integer out, and a dropdown that offers exactly two operations - add and subtract. No multiply, no divide, no modulo. That's not a deficiency; it's scope discipline. This node exists to be the loop counter inside the pack's hidden while-loop machinery, where all you need is "increment this by one each pass."
It's an .internal node, so it's hidden from the node menu by the pack's front-end code. You'll meet it in saved workflows as the little thing that recomputes an index or a running total inside a loop body - the kind of value that has to be recalculated every iteration because it can't just sit in a widget.
The range is generous (±999,999,999), which matters for upscaling math where step totals and pixel dimensions can get large, and the operation enum is explicit rather than a free-form expression - no parsing surprises, nothing to debug. If you need real arithmetic, reach for something with an expression evaluator; if you need a counter, this is it.
Inputs
- a - first integer.
- b - second integer.
- operation -
addorsubtract(defaults toadd).
Output
value - a + b or a - b, as an INT.
Installing it
Part of yiu_comfy_nodes by leizingyiu:
cd ComfyUI/custom_nodes
git clone https://github.com/leizingyiu/yiu_comfy_nodes
restart ComfyUI, and it's there (hidden) for anything that saves a workflow using it. No extra dependencies.
Where people get burned
- You can't add it from the menu. It's hidden on purpose. If a workflow loads with one, it just works - you don't need to find it.
- Expecting multiply/divide. The dropdown only offers add and subtract. If you wire this in and wonder why there's no
*, that's by design; the pack keeps a separate comparator node (__y_i_u__compare) for logic and this one for stepping. - Watch which side is the accumulator.
subtractisa - b, not the absolute difference. In a loop,ais typically the running value andbthe step.
Inputs (3)
| Name | Type | Default | Description |
|---|---|---|---|
| a | INT | 0-999999999–999999999 | — |
| b | INT | 0-999999999–999999999 | — |
| operation | COMBO | 2 options: add, subtract |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| value | INT | — |