Nodes/ComfyUI-Transformers/Float to String
ComfyUI Node

Float to String

Convert Numbers to Text in ComfyUI (Float to String)

By kadirnar·Created 3 years ago·Updated 7 months ago· 25
Float to String
    • text
    value0.00

    Float to String is exactly what it says: it takes a float number and hands it back as text. It's one of the pack's small utility nodes, the sort of thing that looks pointless until you need to jam a number into a string - build a dynamic prompt, compose a filename, or log a value into a text display. It's ComfyUI's answer to "how do I get this number into a sentence."

    The implementation is gloriously simple: str(value). The node takes whatever float you feed it, runs Python's string conversion, and returns the result. There's no formatting, no rounding control, no scientific-notation handling - 0.5 becomes "0.5", a very long float becomes a very long string. It's a type conversion node and nothing more.

    The input and output

    • value - a FLOAT input, default 0.0. Wire it from any node that outputs a float - a sampler's CFG, a KSampler's denoise, a model's metadata.

    The output is text, a single STRING. Connect it to a text display, a prompt-builder, or a filename-saving node.

    How to install it

    Standard pack install - ComfyUI Manager (search "ComfyUI-Transformers") or:

    cd ComfyUI/custom_nodes
    git clone https://github.com/kadirnar/ComfyUI-Transformers
    

    Restart ComfyUI. There's no model download - this is pure Python, no transformers involved. One of the rare nodes in this pack that works offline and instantly.

    Where people get burned

    Formatting. Because it's a bare str() call, you get the full float as Python renders it - 0.30000000000000004-style artifacts can show up when you stringify a computed float, and there's no knob to round to two decimals. If you need controlled formatting ("0.50" instead of "0.5"), you'll want a text-formatting node that supports format specifiers. It's also not a very smart node - no locale handling, no thousands separators. For the simple "turn this number into text so I can put it in a prompt," though, it does the job with zero fuss.

    CategoryTransformers/Utility

    Inputs (1)

    NameTypeDefaultDescription
    valueFLOAT0.00

    Outputs (1)

    NameTypeDescription
    textSTRING