Round
Round to N Decimals, and the Banker's Rounding Surprise
- value
- MATCHTYPE
UC_MathRound rounds a number to a chosen number of decimal places. 3.14159 with 2 decimals becomes 3.14; 42.7 with 0 decimals becomes 43. It's the "clean this number up before it goes somewhere that matters" node - and it has one quirk inherited from Python that will make you do a double-take exactly once.
Why you'd reach for it
Computed values are never tidy. A denoise strength from a formula comes out as 0.5678321, and you're about to embed it in a filename or show it in a note - round it to 2 decimals and it reads like a human wrote it. Same story for CFG, steps-derived values, or anything headed into a text template. It's also the finishing move after an exponent or division chain: compute with full precision, round at the edge, and never let a floating-point artifact leak into a filename or a prompt string.
How it works
A round(value, decimals) call. The decimals input is an integer from 0 to 10, defaulting to 0 - at 0 you get the nearest whole number. The output uses the MatchType template, so it mirrors the input type. The quirk: Python uses banker's rounding, meaning ties round to the nearest even number. round(2.5) gives 2, round(3.5) gives 4. Most people learned "round half up" in school, so the first time they round 2.5 and get 2 they assume the node is broken. It's not - that's just how Python does it, and for most image-generation purposes it genuinely doesn't matter.
The inputs that matter
value- what you're rounding.decimals- 0 to 10, default 0. This is the one you'll actually change.
Installing it
It's in ComfyUI-UtilsCollection. ComfyUI Manager → search "ComfyUI-UtilsCollection" → Install → restart, or:
cd ComfyUI/custom_nodes
git clone https://github.com/silveroxides/ComfyUI-UtilsCollection
Restart. No models; the pack's requirements are just opencv-python and typing-extensions.
The takeaway
Round where it matters and keep full precision everywhere else - that's the whole skill, and it's the difference between filenames like steps-37.9999999 and steps-38. If you're migrating from ComfyUI-LogicMath, this is the replacement for its round node: accept the swap, uninstall the old pack. And if you ever see 2.5 → 2 and reach for a bug report, remember the banker. This is one of those nodes you install for the filenames and keep for the peace of mind.
Inputs (2)
| Name | Type | Default | Description |
|---|---|---|---|
| value | COMFY_MATCHTYPE_V3 | — | |
| decimals | INT | 00–10 | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| MATCHTYPE | COMFY_MATCHTYPE_V3 | — |