Nodes/quadmoon's ComfyUI nodes/Convert Float to String
ComfyUI Node

Convert Float to String

Your Actual CFG Value, As Text You Can Put in a Filename

By traugdor·Created 3 years ago·Updated 9 months ago· 16
Convert Float to String
    • STRING
    float_input

    ComfyUI's sampler settings are floats - the 8.0 in your CFG field, the 0.5 denoise, the 1.5 upscale ratio. If you want one of those actual runtime values to appear anywhere as text, you can't just type it in: if you change the sampler, your typed label silently lies to you. This node converts a float to a string so the label always tells the truth.

    Why you'd reach for it

    Filename automation is the classic use. Save nodes that build filenames from parts (my_workflow_cfg8.0.png) usually take strings, so you convert the CFG value with this node and wire it in. It's also handy for debug workflows - print the actual denoise being used to a display node and stop guessing. It sits naturally alongside the pack's other converters, especially if you're assembling a label from a float and a couple of ints.

    How it works

    Straightforward: the node takes your float and returns str(float_input). Feed it 7.5 and you get "7.5"; feed it 8.0 and you get "8.0". Like the pack's other converters it type-checks first, so it expects a genuine FLOAT value - if you hand it a string or an int, it raises an error instead of quietly mangling things.

    Inputs and outputs

    • float_input - the FLOAT to convert. The one input.
    • STRING - the output, ready for filenames, text overlays, or prompt assembly.

    Nothing else to configure. It's about as zero-config as a node gets.

    Installing it

    It's part of traugdor's "quadmoon's ComfyUI nodes" pack. Install through ComfyUI Manager (search the pack title, or Install via GIT URL with https://github.com/traugdor/ComfyUI-quadMoons-nodes.git), or manually:

    cd ComfyUI/custom_nodes
    git clone https://github.com/traugdor/ComfyUI-quadMoons-nodes.git
    

    Restart ComfyUI and it appears under QuadmoonNodes/Converters. No models, no extra dependencies.

    Common issues

    The usual gotcha is feeding it a value that isn't a real float - for instance wiring a string widget in and getting a "not a float" error. And remember the output is a faithful str() of the number: you get "8.0", not "8", so if you're building a filename, that's fine, but if you're comparing strings later, the trailing .0 is there and will matter.

    CategoryQuadmoonNodes/Converters

    Inputs (1)

    NameTypeDefaultDescription
    float_inputFLOAT

    Outputs (1)

    NameTypeDescription
    STRINGSTRING