Number Round
Stop tripping over floating point noise
- rounded
- rounded_string
Floats lie. Do enough math in a workflow and you'll eventually get a 0.30000000000000004 where a sane 0.3 should be, or a denoise value that prints as 0.7499999999 and makes your logs look broken. Number Round cleans that up: it rounds a value to a chosen number of decimal places and hands you both the number and a pretty string version. If your workflow generates filenames, labels, or anything a human reads, this is the node that keeps it tidy.
It ships in DebugPadawan's ComfyUI Essentials, a small pure-Python utility pack. No models, no GPU - this is round() plus a format string.
How it works
Two required inputs:
value- the float to round (default 0)decimal_places- 0 to 10, how many digits after the point (default 2)
Two outputs:
rounded- the number as a FLOATrounded_string- the same value formatted as a STRING, always showing exactlydecimal_placesdigits
The string output is the sneaky-good part. rounded as a float still carries binary floating-point baggage; rounded_string uses f"{value:.2f}"-style formatting, so you get clean text like "3.14" instead of "3.1400000000000001". That's the output to feed into a Text Joiner or a filename builder.
Where you'll use it
- Filenames and labels. Save nodes and metadata builders want clean strings; round your CFG, strength, or seed-derived values before formatting.
- Debug output. A clean
0.75beats a0.75000000001in any log orDebug Print. - Int-adjacent work. Set
decimal_placesto 0 to collapse a float to a whole number (as a float) before converting.
Installing it
One install gets the whole pack. ComfyUI Manager, searching for "DebugPadawans-ComfyUI-Essentials," or:
cd ComfyUI/custom_nodes
git clone https://github.com/DebugPadawan/DebugPadawans-ComfyUI-Essentials
Then restart ComfyUI. Its requirements (numpy, torch, opencv-python) are already in stock ComfyUI; nothing to download, no models. Just don't get it mixed up with cubiq's "ComfyUI Essentials" - different pack, in maintenance mode, and easy to click by accident in Manager's search results.
Gotchas
- Python's
round()uses banker's rounding.round(2.5)gives2, not3, because Python rounds half-to-even. If you're doing financial-style rounding or anything where "up" matters at exactly .5, this node (like Python itself) will surprise you. Therounded_stringuses the same underlying rounding. - The two outputs agree, but aren't interchangeable.
roundedis a float for math;rounded_stringis text for humans and filenames. Wire accordingly. - It's a tiny, quiet node from a small pack - no model downloads, no community drama, just round and ship.
Inputs (2)
| Name | Type | Default | Description |
|---|---|---|---|
| value | FLOAT | 0.00 | — |
| decimal_places | INT | 20–10 | — |
Outputs (2)
| Name | Type | Description |
|---|---|---|
| rounded | FLOAT | — |
| rounded_string | STRING | — |