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

Convert Int To Float [LP]

Convert Int To Float [LP] — ComfyUI Node Guide

By LevelPixel·Created 2 years ago·Updated 5 months ago· 31
Convert Int To Float [LP]
    • FLOAT
    int0

    The plainest possible type conversion: an integer goes in, the exact same value comes back out as a float. No rounding, no math, just relabeling the type so ComfyUI's socket system will let the wire connect.

    Why this needs to be a node at all

    ComfyUI enforces its socket types strictly - an INT output physically won't connect to a FLOAT input, even though 5 and 5.0 are the same number to a human. That's a deliberate design choice in ComfyUI (it stops you from accidentally feeding the wrong kind of data somewhere and getting silently wrong results), but it means anywhere your workflow has an integer coming from a counter, an iterator index, or a widget, and the next node down the line actually wants a FLOAT - a strength value, a scale factor, anything with a decimal-friendly range - you need an explicit converter in between. This is that converter.

    It's one entry in this pack's larger conversion toolkit, which the README describes as covering more type pairs than most comparable packs: StringToFloat, StringToInt, StringToBool, StringToNumber, StringToCombo, IntToString, FloatToString, BoolToString, FloatToInt, IntToFloat, IntToBool, BoolToInt. This one and Convert Int To Bool are the pair covered in this article.

    Inputs and outputs

    • int (INT, default 0) - the value to convert. Min/max sit at roughly ±1.8×10¹⁹, which is just ComfyUI's standard unbounded INT range rather than a real practical limit.

    Output: FLOAT - the same numeric value, now typed as a float.

    Installing it

    ComfyUI Manager: search "ComfyUI-LevelPixel" (listed as "Level Pixel"), install, restart. Manual: cd ComfyUI/custom_nodes && git clone https://github.com/LevelPixel/ComfyUI-LevelPixel.git, restart ComfyUI. No dependencies, no downloads - this is about as simple as a custom node can be.

    Common issues

    Honestly, not much can go wrong here - it's a straight cast. The one thing worth knowing is that this is a one-way trip in the sense that the node itself doesn't round or scale anything; if you're feeding this an index from Iterator or one of this pack's other counter-shaped nodes and expecting the float output to be scaled down to a 0–1 range or similar, it isn't - you're getting the raw number back with a different type tag, nothing more. If you need actual scaling, you'll want a math node after this one, not instead of it.

    And the usual type-direction gotcha: this only takes INT in. If what you're actually holding upstream is a STRING representation of a number (say, from a JSON field via this pack's Get JSON Value), you'll want StringToFloat from this pack's wider conversion set instead - feeding a string straight into this node's int input won't connect.

    CategoryLevelPixel/Conversion

    Inputs (1)

    NameTypeDefaultDescription
    intINT0-18446744073709550000–18446744073709550000

    Outputs (1)

    NameTypeDescription
    FLOATFLOAT