Nodes/ComfyUI-JakeUpgrade/Int To Float JK๐Ÿ‰
ComfyUI Node

Int To Float JK๐Ÿ‰

Integer in, float out โ€” because math nodes are picky

By jakechaiยทCreated 2 years agoยทUpdated 3 months agoยท 146
Int To Float JK๐Ÿ‰
    • FLOAT
    โ—„a0โ–บ

    ComfyUI's integer and float math live in separate typed worlds, and they don't mix implicitly. CM_IntToFloat is the bridge: INT in, FLOAT out, no rounding because an integer is already an exact float value. It's the dullest node in the pack and one of the most frequently needed.

    Why the split even exists

    Look at the operation lists in the pack's math section and the types are strict - CM_IntBinaryOperation's Div is floor division (7 // 2 = 3), because integers can't represent 3.5. The float nodes do real division. When you want 7 / 2 = 3.5, you need the inputs to be floats first, and that's precisely when you convert: take an int (a frame count, a step number, a seed fragment), convert, and let the float side handle fractional math.

    Typical flow: a node gives you an integer, you want to scale it by a float strength or mix it into a float expression. Convert at the boundary, then feed CM_FloatUnaryOperation or CM_FloatBinaryOperation. The pack also has the reverse direction - CM_FloatToInt, which truncates the decimal part, so be careful which way you're crossing.

    Installing it

    Part of ComfyUI-JakeUpgrade:

    cd ComfyUI/custom_nodes
    git clone https://github.com/jakechai/ComfyUI-JakeUpgrade
    cd ComfyUI-JakeUpgrade
    # Windows standalone: install.bat
    # or: python_embeded\python.exe -s -m pip install -r requirements.txt
    pip install -r requirements.txt   # non-Windows
    

    Or ComfyUI Manager, search "JakeUpgrade", install, restart. No downloads.

    Gotchas

    • Convert once, not everywhere. The float side of the pack can do everything the int side does with more precision; converting at the source and staying in float is cleaner than shuttling back and forth.
    • Int-to-float is lossless; the reverse isn't. Always convert int โ†’ float when precision matters, and remember CM_FloatToInt truncates rather than rounds.
    • Manager's JakeUpgrade / IPAdapter_plus conflict warning is a false positive from the pack's replacement/ folder.
    • ComfyUI-MultiGPU causes CUDA errors with recent ComfyUI - disable it, per the README.
    Category๐Ÿ‰ JK/โœ–๏ธ Math/๐Ÿ’  Conversion

    Inputs (1)

    NameTypeDefaultDescription
    aINT0Input integer value to convert

    Outputs (1)

    NameTypeDescription
    FLOATFLOATโ€”