Nodes/comfyUI-tool-2lab/input or convert float 输入或转换浮点数
ComfyUI Node

input or convert float 输入或转换浮点数

One float in, three types out — the conversion node you keep reaching for

By AI2lab·Created 2 years ago·Updated 2 years ago· 23
input or convert float 输入或转换浮点数
    • int
    • float
    • string
    float0.00

    ComfyUI is stubborn about types. Some nodes hand you a FLOAT, the next node demands an INT, and the type-checking on the wire refuses to play along - so you sit there hunting for a conversion node. FloatNode (2lab) is the answer to that specific frustration. Feed it one number and it gives you that same number in three flavors: integer, float, and string. That's the whole trick, and honestly it's enough.

    The name in the pack's own Chinese label spells out the design: "输入或转换浮点数" - input or convert a float. You can type a value directly into the widget, or use it purely as a converter when something upstream hands you a number in the wrong shape.

    How it works

    The single required input is float (a FLOAT, default 0). Type your number and the node pushes it out on three ports simultaneously:

    • int - the value as an integer. Float-to-int drops the fractional part, so 4.7 gives you 4; that's standard Python behavior and almost certainly what's happening under the hood.
    • float - the value unchanged, if some downstream node wants a proper FLOAT.
    • string - the value as text, for anything that needs a STRING number (handy when an LLM node wants to see "4.7" in a prompt rather than receive a number).

    The practical move is to take whichever output matches what the next node expects. Resolution multiplier wants an INT? Grab the int port. A conditioning scale wants a FLOAT? Grab that one. A text formatter wants the string? You get the idea. It's the numeric equivalent of an adapter plug, and it kills a whole class of "type mismatch" errors without pulling in a heavyweight utility suite.

    One quirk worth knowing: the node is flagged as an output node in its definition, which mostly means ComfyUI treats it as graph-terminal-friendly - it doesn't change how it behaves, so don't overthink it.

    Installing it

    It's part of the AI2lab/comfyUI-tool-2lab pack. ComfyUI Manager → search comfyUI-tool-2lab → Install → restart, or:

    cd ComfyUI/custom_nodes
    git clone https://github.com/AI2lab/comfyUI-tool-2lab
    

    Then restart ComfyUI. As with the rest of this pack - a Chinese dev's collection of small utilities, every node carrying a 中文 label, README one word long - there are no models to download and no dependency fights. If you're tired of writing converter nodes by hand or stacking conversion packs just for one type cast, this is the boring, reliable fix. Not glamorous, but it does the job and never asks for a key.

    Category🦊2lab/util/number

    Inputs (1)

    NameTypeDefaultDescription
    floatFLOAT0.00-18446744073709550000–18446744073709550000

    Outputs (3)

    NameTypeDescription
    intINT
    floatFLOAT
    stringSTRING