Number Round | Basic
Rounding to N decimals, without the floating-point surprises
- value
- FLOAT
NumberRound ("Number Round | Basic") rounds a number to a chosen number of decimal places. Feed it value and decimals, and out comes the rounded FLOAT. It sounds trivial until you're feeding a sampler a value with eleven digits of noise and wondering why nothing matches what you typed - rounding is a cleanup step every workflow needs eventually.
The inputs: value (INT or FLOAT) and decimals - an INT from 0 to 10, default 2. The output is normally a FLOAT, with one nicety: if the input was an integer and decimals is 0, you get an INT back instead, so rounding a whole-number chain doesn't force a type change.
The inputs that matter
- value - the number to round.
- decimals - how many decimal places to keep.
0rounds to a whole number.
Why you'd reach for it
Two honest use cases. First, cosmetic cleanup: computed values that are really "1.0" but arrive as 0.9999999999999999 - rounding to a few decimals turns that mess into something you can read, display, or compare. Second, feeding finicky nodes: some nodes are picky about precision, and a value with fewer decimals is easier to reproduce and easier to match with a comparison later.
One thing I'll flag honestly: the rounding here uses Python's round, which means banker's rounding - ties round to the nearest even number. round(0.5) gives 0, not 1, and round(2.5) gives 2. If your downstream logic cares about that distinction - like a comparison that sits right on a .5 boundary - you'll want to know it's not the "always round half up" your school taught. For most generation-workflow values it never matters, but it's a real behavior, not a bug.
Installing it
Standard pack install - pure Python, zero dependencies:
cd ComfyUI/custom_nodes
git clone https://github.com/akatz-ai/ComfyUI-Basic-Math
Restart ComfyUI, find it under Basic Math ➕ → Utility as "Number Round | Basic". Or use ComfyUI Manager → **Install Custom Nodes → search "ComfyUI-Basic-Math"`.
The gotchas
decimals is capped at 10 - you can't round to eleven decimal places, which is plenty for anything a diffusion workflow produces. And remember the menu suffix: it's "Number Round | Basic", not just "Number Round". If you need to force rounding in a specific direction (always down, always up), that's what ToInt with its floor/ceil round methods is for.
Inputs (2)
| Name | Type | Default | Description |
|---|---|---|---|
| value | INT,FLOAT | 0 | — |
| decimals | INT | 20–10 | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| FLOAT | FLOAT | — |