Round
The node that turns 7.3249 into something you can put in a filename
- FLOAT
- STRING
ComfyUI has plenty of nodes that produce numbers and almost none that tidy them up. Round takes an incoming float, snaps it to a chosen number of decimals, and hands back both a float and a properly formatted string.
What it's for
The sting is always the string. Your graph computes a value - a scale, a computed step, a derived CFG - and you want it in a filename or a metadata field. ComfyUI's float-to-text conversion gives you whatever the IEEE 754 gods decide, so filename_prefix ends up containing Aspect_1.7777777777777777 and your outputs folder becomes unnavigable.
Round fixes it in one node with the right precision for the job. Scale factor for an upscale? One decimal. Denoise you computed from image dimensions? Two. Aspect ratio for a filename? Two, or three if you're being fussy. And because it outputs the rounded value as a real float as well as a string, you can wire the number into a sampler and the string into a filename from the same place - no second conversion node.
How it works
Two required inputs:
float_val-FLOAT, and it's forced to be a wire. No text box, so something upstream has to produce the number.decimals- a dropdown of0through5, default0.
Two outputs:
FLOAT- the rounded value, as a number.STRING- the same value, formatted.
The formatting is the part with a small surprise in it, and it's a good surprise. With decimals at 0, the string is built as an integer, so you get 8 and not 8.0 - which is exactly what you want in a filename. With any other setting, it's zero-padded to the requested places, so decimals = 2 on the value 1.5 gives you 1.50, not 1.5. Consistent width is worth more than terseness when the string is going into a sortable filename or a metadata line.
The rounding itself is Python's round, which means banker's rounding at exact halves: 2.5 rounds to 2, 3.5 rounds to 4. In practice you'll never notice, because you're rounding numbers that came out of a division, and none of them land on .5 exactly. Just don't use this node for accounting.
Installing it
ComfyUI-MDSNodes by MarwanDSAI. ComfyUI Manager: search ComfyUI-MDSNodes or MDSNodes, install, restart. Manually:
cd ComfyUI/custom_nodes
git clone https://github.com/MarwanDSAI/comfyui-mdsnodes
# restart ComfyUI
Nothing to install beyond that - the repo's requirements.txt is empty, the README confirms no extra packages, and there are no model downloads. It's four lines of arithmetic.
Search Round, category MDSNodes/Math. It's the pack's only maths node, which makes it easy to find and easy to forget exists.
Common issues
You can't type a number into it. float_val is a forced input by design. Feed it from a Float (2 Dec) constant or an upstream computation.
The string didn't make it into your filename. filename_prefix accepts literal text plus %NodeName.widget% tokens pulled from a node's widget - it doesn't take a wire. If you're building the name from a computed value, you want a save node that accepts a string input, or a merge/string node feeding it. The metadata doc covers what actually ends up in the file.
You wanted 2.5 to become 3. Banker's rounding, as above. If you need half-up, add 0.5 before rounding by hand for positive values and stop there - it's not worth another node.
The FLOAT output still shows trailing digits downstream. You're wired to the wrong output, or the target is formatting it itself. The STRING output is the one with the formatting baked in.
Not in the node list. Shipped in pack version 1.8.0 (September 2026). Update in Manager and restart ComfyUI.
Inputs (2)
| Name | Type | Default | Description |
|---|---|---|---|
| float_val | FLOAT | The floating-point number to round. | |
| decimals | COMBO | 0 | Number of decimal places to round to. |
Outputs (2)
| Name | Type | Description |
|---|---|---|
| FLOAT | FLOAT | The rounded number as a float. |
| STRING | STRING | The rounded number formatted as a string. |