Float to Int
Rounding, but you get to pick which kind
- int_value
ComfyUI is picky about types in a way that drives beginners up the wall: some nodes demand an INT, your math produced a float, and the wire just won't connect. Float to Int is the handshake node for that moment. Feed it a float, pick a rounding strategy, get an int out. Three modes, one output, done.
It's part of DebugPadawan's ComfyUI Essentials, a small MIT-licensed utility pack. This is one of its more honest members - a dedicated conversion node that doesn't try to do seven things.
The inputs that matter
- value - the FLOAT you're converting.
- mode - the interesting bit:
round,floor, orceil.roundis nearest-integer.flooralways goes down:3.7 → 3.ceilalways goes up:3.2 → 4.
One output: int_value, an INT, ready to plug into whatever integer-only input was blocking you.
The trap: banker's rounding
Here's where people get genuinely surprised. round uses Python's built-in round(), which implements banker's rounding (round-half-to-even). That means 2.5 rounds to 2, not 3 - because 2 is even. 3.5 rounds to 4. If you're converting a value that lands exactly on .5, this is not the rounding you learned in school. For the vast majority of workflow math it never matters, but the first time you hit it, it feels like a bug.
If you need classic half-up rounding, or you just want predictable behavior on exact halves, floor/ceil are unambiguous - pick the direction you actually want.
Install
Standard custom-node fare:
cd ComfyUI/custom_nodes
git clone https://github.com/DebugPadawan/DebugPadawans-ComfyUI-Essentials.git
Restart ComfyUI, or install via ComfyUI Manager by searching "DebugPadawan". requirements.txt lists numpy, torch, and opencv-python - numpy and torch already ship with ComfyUI and the shipped code never imports cv2, so there are no heavy downloads and no model files. No API keys.
Troubleshooting
The only real failure mode is expecting the wrong rounding behavior. If you're off by one on exact .5 values, that's banker's rounding, not a bug - switch to floor or ceil if you care. Otherwise this node is as close to zero-surprise as a conversion node gets: it takes what it's given, applies the mode, hands you an int.
Inputs (2)
| Name | Type | Default | Description |
|---|---|---|---|
| value | FLOAT | 0.00 | — |
| mode | COMBO | 3 options: round, floor, ceil |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| int_value | INT | — |