Nodes/Eagleshadow Custom Nodes/Round Float to String
ComfyUI Node

Round Float to String

Round Float to String – ComfyUI Node Guide

By Shadetail·Created 2 years ago·Updated about a year ago· 6
Round Float to String
    • STRING
    float
    string

    What it is

    A tiny formatting node that does exactly one thing: takes a floating-point number, rounds it to two decimal places, sticks a string prefix in front of it, and hands back the combined result as text. The author built it, by their own description, to stamp a numeric value with a little label into filenames - think cfg_7.50 or denoise_0.85 showing up as part of a saved image's name so you can tell your batch outputs apart at a glance.

    It's the connective tissue node, not the star of the show. You'll almost never use it alone - it exists to feed into something that saves or labels things, like this pack's own Save Image to Folder.

    How it works

    No surprises here: round the float to 2 decimal places, convert to a string, concatenate it onto whatever string you gave it, return the result. There's no separator inserted automatically between your prefix and the number - if you want cfg_7.50 rather than cfg7.50, put the underscore or space at the end of your own string input.

    Inputs and outputs

    • float – the number you want rounded and appended. No default value is defined, so wire something in rather than leaving it hanging.
    • string – the prefix text, default empty string. Whatever you put here comes first, the rounded number gets tacked on after.
    • output – a single STRING: your prefix plus the rounded float.

    That's the entire interface. Two inputs in, one string out.

    Installing it

    Comes bundled with the rest of the pack:

    cd ComfyUI/custom_nodes
    git clone https://github.com/Shadetail/ComfyUI_Eagleshadow
    

    Or install "Eagleshadow Custom Nodes" through ComfyUI Manager. No models to download, no extra Python packages - it's a pure string operation.

    Common issues

    No separator gets added for you. This trips people up the first time: if your prefix string is "cfg" and the float is 7.5, the result is cfg7.50, not cfg_7.50 or cfg 7.50. If you want a divider, bake it into the prefix string yourself.

    Always two decimal places, no way to configure it. If you wanted a whole number or three decimals for something like a seed multiplier, this node won't give you that - it's hardcoded to two. For anything other than exactly two decimal places, you'd need a different node or a bit of your own string logic.

    It's building a string, not validating a filename. Nothing here strips characters that are invalid in a filename (this matters less with numbers, since 0-9 and . are filename-safe on every OS, but keep it in mind if you ever pipe unexpected values through it). Since it's meant to feed into a save node's filename field, keep the prefix simple and alphanumeric and you won't run into trouble.

    It's a small, unglamorous node, but exactly the kind of glue that keeps a batch-heavy workflow's output folder legible instead of a wall of identical filenames.

    CategoryText/Utilities

    Inputs (2)

    NameTypeDefaultDescription
    floatFLOAT
    stringSTRING

    Outputs (1)

    NameTypeDescription
    STRINGSTRING