Nodes/ComfyUI Level Pixel/Convert Float To String [LP]
ComfyUI Node

Convert Float To String [LP]

Turning a number into text

By LevelPixel·Created 2 years ago·Updated 6 months ago· 31
Convert Float To String [LP]
    • STRING
    float0.00

    Exactly what it says: a FLOAT value goes in, a STRING comes out. It sits alongside IntToString-LP and StringToFloat-LP as one more piece of this pack's conversion family - small, single-purpose nodes that exist because ComfyUI's sockets don't quietly cross type boundaries on their own.

    Why you'd want this

    Any time a number needs to become text - baked into a filename, appended to a log message, embedded in a prompt, or written out through a Show Text node for debugging - you can't just plug a FLOAT socket into a STRING input. Whatever your numeric value is (a CFG value you're recording, a seed's fractional cousin, a calculated dimension), this node is the one step that turns it into something the rest of the text-handling side of ComfyUI can actually use.

    How it works

    It's a plain str(float_value) conversion - no rounding, no formatting options exposed. The node's declared range is enormous (roughly ±1.8×10¹⁹), which isn't a realistic value anyone would type - that's just ComfyUI's default internal float-widget clamp, not a meaningful practical bound. In practice you'll be feeding it ordinary numbers.

    The inputs and outputs that matter

    • float - the number to convert, default 0.
    • Output - a single STRING.

    One input, one output, no configuration.

    How to install it

    ComfyUI Manager: search "ComfyUI Level Pixel" or the repo ComfyUI-LevelPixel, install, restart - updates automatically through Manager's "Update ALL." Manual:

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

    Restart ComfyUI. Pure text conversion, nothing else to install.

    Common issues & troubleshooting

    The output has way more decimal places than you expected, or shows scientific notation. That's a plain str() conversion doing exactly what Python does - it doesn't round to a "clean" number of decimals, and very large or very small values can render in scientific notation (1.5e-05 rather than 0.000015). There's no decimal-places or rounding setting exposed on this node.

    You need a specific number of decimal places for a filename or display string. Round the float upstream first - with a math or round node - before it reaches this node, since FloatToString-LP itself won't do that formatting for you.

    You actually needed an integer-looking string, not a float-looking one. 7.0 stays "7.0" here, not "7". If you want a clean integer string, convert to INT first (this pack's FloatToInt-LP) and then use IntToString-LP instead of this node.

    You need the reverse conversion. That's StringToFloat-LP in the same pack - parsing text back into a real FLOAT - for the other direction of this round trip.

    CategoryLevelPixel/Conversion

    Inputs (1)

    NameTypeDefaultDescription
    floatFLOAT0.00-18446744073709550000–18446744073709550000

    Outputs (1)

    NameTypeDescription
    STRINGSTRING