Math (Int) (Text-Driven)
Loops, steps, dims, and a shift that knows left from right
- int_out
Math (Int) (Text-Driven) is the odd one out in this pack - it's the only node that isn't about prompts at all. It's a small integer calculator you drop in the graph when you need to compute a number mid-flow: batch counts, step offsets, dimensions, loop indices. Where this pack's batch workflow auto-increments its way through 25 scene combinations, this is the node that does the arithmetic underneath that kind of thing.
How it works
Two int inputs, one operation, one int out. a and b both accept values from −999,999,999 to 999,999,999 - comfortably beyond anything a workflow actually needs, so the headline "massive integer range" is really just "you won't overflow it." The operation combo picks what happens:
add,subtract,multiply- plain arithmetic.divideandmodulo- integer division and remainder. These raise a realZeroDivisionErrorifbis zero, which the author intentionally lets propagate. That's a feature, not a bug: it fails loudly with a clear error instead of silently returning garbage.power-araised tob, with the exponent clamped to 0–32 so a mistyped value can't hang your system on a trillion-digit number.shift- the one clever bit. Ifbis positive it's a left shift (a << b), ifbis negative it flips to a right shift (a >> abs(b)), capped at 31 bits. So you get one node that does both directions based on the sign of the second input.
The output is int_out, and it plugs anywhere an int is expected - Empty Latent Image dimensions, step counts, start_index pins on Prompt Line, batch sizes.
The honest take
Most people will reach for a Primitive int node or the built-in arithmetic before they remember this exists, and for a single add or multiply that's the right call. Where Math (Int) earns its keep is chaining a few operations in one small node - computing a step count from a batch size, or deriving a resolution offset - without stringing five nodes together. The power clamp and the sign-aware shift are thoughtful touches you won't find in the stock nodes. It's not going to change your life; it's a tidy utility with better edge-case manners than you expect.
Install
Part of ComfyUI Text-Driven Workflows. ComfyUI Manager → search "ComfyUI Text-Driven Workflows" → Install, or:
cd ComfyUI/custom_nodes
git clone https://github.com/kanryu/ComfyUI-Text-Driven-Workflows.git
Restart. No pip dependencies, no models to download - the pack's dependency list is empty. As with every node here, the real requirement is a current ComfyUI with the V3 extension API; on an older install the pack logs "Failed to load nodes" and nothing appears under Text-Driven Workflows until you update.
Bottom line
A small, safe, dependency-free int calculator that plays nice with the pack's batching story. It won't wow you, but when you need to compute a number mid-graph it does the job without adding a dependency or a failure mode you have to think about.
Inputs (3)
| Name | Type | Default | Description |
|---|---|---|---|
| a | INT | 0-999999999–999999999 | — |
| b | INT | 0-999999999–999999999 | — |
| operation | COMBO | add | 7 options: add, subtract, multiply, divide, modulo, power, +1 |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| int_out | INT | — |