Nodes/ComfyUI-SimpleLogics/Float → String
ComfyUI Node

Float → String

Turning numbers into words

By danipisca07·Created 6 months ago·Updated 6 months ago· 0
Float → String
    • STRING
    value0.00

    ComfyUI is stubborn about one thing: a FLOAT will not go into a STRING port, and a lot of genuinely useful things - filenames, saved metadata, prompts, text overlays - are strings. SL_FloatToString is the bridge. It takes a float and hands you its text representation, so you can stick 0.5 into a filename, a display node, or a prompt-building chain.

    Mechanically it's str(value), plain Python string conversion. That's the whole story, and it's also the limit you need to know about: there is no formatting control. 0.5 becomes "0.5". 1.0 becomes "1.0" (with the decimal, because floats). 7 becomes "7.0". If you were hoping to get "1.00" or to control decimal places, this node won't do it - you'd need to round or format upstream before converting. Knowing that up front saves you a weird five-minute debugging session.

    Inputs and outputs:

    • value (FLOAT) - the number, default 0.0
    • Output: STRING - the text representation

    Installing it

    Part of ComfyUI-SimpleLogics. ComfyUI Manager → search "SimpleLogics" → install → restart, or:

    cd ComfyUI/custom_nodes
    git clone https://github.com/danipisca07/ComfyUI-SimpleLogics
    

    Restart, Add Node → search "Float → String" (menu group SimpleLogics/Convert). No dependencies, nothing to download.

    Where it shows up

    • Filenames: generate image save paths with a parameter baked into the name, like denoise_0.5.png.
    • Metadata: stringify a value to stash it in a text/metadata node alongside your workflow.
    • Prompt assembly: inject a numeric parameter into a prompt or text template as a literal string.
    • Text display: show a computed value as a label or on-screen overlay so you can actually see what the math produced.

    Gotchas

    • The "7.0" surprise. Floats carry their decimal point into the string. If you want "7", convert from an integer instead (SL_IntToString), or make sure the value is an integer float before converting.
    • No precision control. For "give me two decimals," this node can't. Round the value first (a math node), then convert - you'll get "3.14" from 3.14, but str() will happily output 3.1400000000000001 for a float that has accumulated noise. Rounding first is the honest fix.
    • Floating-point noise in output. This is the big one: a computed float like 0.30000000000000004 stringifies to exactly that mess. If your number comes from arithmetic, clean it up before converting or your filenames will look like a cry for help.

    For the integer version, the pack's SL_IntToString does the same job without the decimal baggage. Choose by the type of your source, and remember the formatting limitation either way.

    CategorySimpleLogics/Convert

    Inputs (1)

    NameTypeDefaultDescription
    valueFLOAT0.00

    Outputs (1)

    NameTypeDescription
    STRINGSTRING