Round
Turning 2.9999999 into the integer everyone else needs
- value
- MATCHTYPE
Numbers in ComfyUI lie. A denoise of 0.65 multiplied by 4, divided by something, and multiplied back can come out as 2.5999999999999996 - and the moment that value lands in a node demanding an integer, you get to find out what a bad day in the graph looks like. MathRound is the bouncer that cleans the number up before it embarrasses you.
It comes from silveroxides/ComfyUI-LogicMath, the compact math-and-logic pack whose entire README is "Logic operators and Math nodes based on a PR that never got merged." Same author who maintains Chroma-GGUF. The nodes are V3-native - built against ComfyUI's newer extension API (comfy_api.latest) with no legacy NODE_CLASS_MAPPINGS - so the install story is "needs a current ComfyUI," full stop.
How it works
MathRound is a wrapper around Python's round(). You give it a value and a decimals count, and it rounds the value to that many decimal places:
decimalsdefaults to 0 - that's "round to a whole number," the mode you'll use 90% of the time.- You can push it up to 10 decimal places if you need a cleaner float rather than an integer.
- The range is clamped between 0 and 10, so you can't accidentally set decimals to -1 and truncate to tens.
The output uses the pack's MatchType behavior: feed it an int and get an int back; feed a float and get a float back. Round a float to 0 decimals and you still get a FLOAT (like 2.0), which is the one thing to remember - rounding to an integer and being an integer are different things in ComfyUI's type system.
One Python quirk worth knowing: round() uses banker's rounding, so round(2.5) gives 2 and round(3.5) gives 4 - ties round to the nearest even number. If that ever bites you (it rarely does in practice), remember it's the language's rule, not this node's bug.
Inputs and outputs that matter
value- the int or float to round.decimals- how many decimal places to keep, 0–10, default 0.- Output - the rounded value, same type as the input.
That's the whole thing. No mode dropdown, no hidden settings.
Installing it
ComfyUI Manager: Manager → Install Custom Nodes → search "ComfyUI-LogicMath". Or manually:
cd ComfyUI/custom_nodes
git clone https://github.com/silveroxides/ComfyUI-LogicMath
Restart ComfyUI. No models to download, no extra Python packages - the only dependency is comfy_api, which ships with modern ComfyUI.
Common gotchas
- Rounding to a float ≠ integer.
2.0is not2to a type-checking input. If the receiving node demands an INT, run the rounded float through MathNumberConvert - that's the node that actually coerces the type. - V3-only. Old ComfyUI won't register this pack at all since it has no legacy mappings. Update ComfyUI before you start debugging "why is the node missing."
- Decimals are a max, not a policy. Rounding to 10 decimals is fine, but if a value computes to
2.5you'll still get2.5- Round doesn't invent precision.
Round is the least flashy node in the pack and the one you'll quietly depend on the moment your workflow grows past "type in a number and hit generate."
Inputs (2)
| Name | Type | Default | Description |
|---|---|---|---|
| value | COMFY_MATCHTYPE_V3 | — | |
| decimals | INT | 00–10 | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| MATCHTYPE | COMFY_MATCHTYPE_V3 | — |