DD Integer Math
Arithmetic for integers, minus the converter nodes
- int_result
- float_result
ComfyUI is weirdly stingy with basic arithmetic. Need to add two numbers, multiply a width by two, or step a counter? Core gives you almost nothing, so you either install a big utility pack or hand-roll it. DD Integer Math is the minimal fix: two integers in, one operation picked from a dropdown, and - the part I like - it hands back both an integer and a float result, so you don't need a separate type-conversion node downstream.
How it works
Feed it a and b (both INT, default 0) and pick an operation:
- add, subtract, multiply - exactly what they say.
- divide - returns an integer result. Read that twice: 5 ÷ 2 gives 2, not 2.5. The fractional version comes out the
float_resultoutput instead. - modulo - the remainder,
a % b. Zero ifbis 0. - power -
a ** b. - min / max - whichever of the two is smaller or larger.
The outputs are int_result (INT) and float_result (FLOAT). Same math, two views of it. The float output is what rescues you when an integer division quietly chops off the fraction you needed.
The gotchas that will actually bite
Two, and both are grounded in the source:
Division truncates. On the int side, 5 / 2 is 2. ComfyUI has no "keep the remainder" convention here - you just have to remember which output you're reading. If you need real division, use DD Float Math with floats instead.
Divide and modulo by zero return 0, not an error. The author explicitly guards against the crash, which is nice for batch processing - but it's also silent. If your graph starts producing zeros, check whether b went to 0 rather than assuming the node broke.
Where you'll use it
It's the workhorse for dimension math (feed DD Get Image Size width into "× 2" for an upscale factor), seed tweaks, step counters for animation schedules, and any place a workflow needs "this value plus that value" without dragging in a full math-expression node. If you already have WAS Node Suite or rgthree installed you probably have a richer math node - this one is for people who want the DD pack's minimalism without the bloat.
Installing it
It ships in the ComfyUI_DD_Nodes pack by Digital Divas, alongside DD Float Math and the two conversion nodes. ComfyUI Manager → search "DD Nodes", or:
cd ComfyUI/custom_nodes
git clone https://github.com/digital-divas-admin/ComfyUI_DD_Nodes.git
Restart ComfyUI. The pack's requirements.txt is empty - no extra dependencies, no model downloads. When Manager lists results, double-check the repo is digital-divas-admin/ComfyUI_DD_Nodes; an unrelated project also goes by "ComfyUI-DD-Nodes."
Inputs (3)
| Name | Type | Default | Description |
|---|---|---|---|
| a | INT | 0 | — |
| b | INT | 0 | — |
| operation | COMBO | add | 8 options: add, subtract, multiply, divide, modulo, power, +2 |
Outputs (2)
| Name | Type | Description |
|---|---|---|
| int_result | INT | — |
| float_result | FLOAT | — |