Nodes/ComfyUI-FairLab/Int To Float
ComfyUI Node

Int To Float

The type-checker's peace offering

By yanhuifair·Created 2 years ago·Updated 3 months ago· 2
Int To Float
    • value
    value

    ComfyUI is stricter about types than it looks. Integer math produces an INT, but half the widgets you'll want to feed that result into - denoise strength, CFG, LoRA strength, a scale factor - are FLOAT sockets, and the graph won't let you drag an INT wire onto them. Int To Float is the two-node-long answer: one value INT in, one value FLOAT out. It's a cast, nothing more.

    You hit this constantly once your workflow grows a little math. Say you're computing a canvas dimension with the logic nodes, or pulling an integer out of an image-size node, and you want to hand it to something expecting a float. In stock ComfyUI your options are a Primitive node that happens to type-match, or wrestling with the type system. FairLab's logic pack exists precisely so you don't have to - Int To Float sits next to Float To Int, Number, and the arithmetic nodes as the plumbing layer that keeps numbers flowing in the right type.

    Inputs and outputs

    • value (INT) in → value (FLOAT) out.

    One in, one out, same value, wider type. The conversion is a straight float() cast, so 42 becomes 42.0 - no rounding, no surprises.

    How it works

    The whole function body is float(value). There's no hidden behavior to trip you up, which is the point: it exists so the graph's type system stops being a wall between your integer math and your float-consuming nodes.

    Where it fits

    Chain it after anything that computes an integer you later want to feed to a strength or scale input - a Multiply Int, a Number node's integer output, a resolution calc. If you find yourself reaching for it constantly, that's FairLab's Number node doing the same job with nine derived outputs at once.

    Install

    FairLab is one pack, installable via ComfyUI Manager (search ComfyUI-FairLab) or manually:

    cd ComfyUI/custom_nodes
    git clone https://github.com/yanhuifair/ComfyUI-FairLab.git
    cd ComfyUI-FairLab
    pip install -r requirements.txt
    

    Restart after installing. This node needs no extra dependencies - the pack's requirements (opencv, requests, perfect-pixel, etc.) only matter for its image and video nodes. Find it under Fair/logic.

    Gotchas

    • There's no precision loss going INT → FLOAT; it's lossless. The opposite direction (Float To Int in the same pack) truncates and can surprise you.
    • Some workflows sidestep this entirely by keeping a Number node's float output around instead of casting mid-graph. Casting is fine when the value genuinely starts as an integer; just don't build a cast for every socket when a single float constant would do.
    CategoryFair/logic

    Inputs (1)

    NameTypeDefaultDescription
    valueINT

    Outputs (1)

    NameTypeDescription
    valueFLOAT