IntBinaryOperation
Arithmetic and bitwise logic on whole numbers
- INT
IntBinaryOperation is FloatBinaryOperation's integer counterpart, and it's a bigger node than it looks: 16 operations in the dropdown against Float's 11. The extra ones are bitwise logic gates - And, Nand, Or, Nor, Xor, Xnor - on top of the standard arithmetic set (Add, Sub, Mul, Div, Mod, Pow, plus more the picker didn't fully enumerate). That split exists because bitwise operations only make sense on whole numbers; there's no bitwise AND of two floats. If you're doing anything with integer flags, masks, or seed manipulation and need actual bit-level logic rather than boolean true/false logic, this is the node that has it - BoolBinaryOperation handles true/false, this handles the bits underneath integers directly.
How it works
Pick an operation from op, feed two integers into a and b, get one integer back. The arithmetic operations behave as you'd expect from any calculator; the bitwise ones operate on the binary representation of the integers directly rather than their numeric value.
The inputs and outputs that matter
- op - the operation dropdown, arithmetic and bitwise both live here.
- a, b - the two integer operands (default
0). - Output - a single INT, ready for anything downstream expecting a whole number: a seed, a step count, a batch size.
Installing it
Search ComfyMath in ComfyUI Manager, or:
cd ComfyUI/custom_nodes && git clone https://github.com/evanspearman/ComfyMath
then restart ComfyUI. No extra Python dependencies, no models - the whole pack is a handful of files.
Common issues
Most people never touch the bitwise half of this node - day-to-day ComfyUI workflows are almost entirely arithmetic (batch counts, dimension math, step calculations), and the bitwise gates are a niche you'll only need if you're doing something unusual with integer masks or flag values. If all you want is straightforward math on two whole numbers, the arithmetic operations here work exactly like FloatBinaryOperation's, just rounded to ints.
Watch Div: integer division by 0 errors the run rather than producing a silent garbage value, same as its float sibling - worth a thought if b is coming from a computed value rather than something you're typing in by hand. And if you actually need integer division in the floor sense (rounding down rather than truncating toward zero), make sure you're picking the operation meant for that rather than assuming plain Div does it - the two behave differently on negative numbers.
Same maintenance note as the rest of the pack: ComfyMath hasn't seen active development since roughly early 2024 by community accounts, but it's dependency-free arithmetic with no model weights involved, so that inactivity hasn't caused practical problems for people still using it.
Inputs (3)
| Name | Type | Default | Description |
|---|---|---|---|
| op | COMBO | 16 options: Add, Sub, Mul, Div, Mod, Pow, +10 | |
| a | INT | 0 | — |
| b | INT | 0 | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| INT | INT | — |