ComfyUI Node

floatToInt _O

The conversion nobody reads the docs for

By omar92·Created 3 years ago·Updated 5 months ago· 181
floatToInt _O
    • INT
    float0.00

    ComfyUI is strict about types in a way that drives beginners up the wall: some nodes want an INT, others hand you a FLOAT, and the wire won't connect if the types don't line up. floatToInt _O is the adapter - it takes a floating-point number and hands you an integer version of it. It's the kind of node you only search for when a connection refuses to snap, and then it saves your afternoon.

    It comes from the numbers folder (O/numbers) of the Quality of Life Suit pack, sitting alongside intToFloat _O, floatToText _O, and the pack's equation nodes. When you're computing a value - say, a WidthFactor from an equation that spits out FLOAT - and the next node wants an INT (an index, a resolution, a count), this is the bridge.

    How it works

    Under the hood it's a single line: int(float). Python's int() conversion, which means one specific behaviour you should know about: it truncates toward zero, it doesn't round. 2.9 becomes 2, not 3. If you're converting an upscale factor or a computed size and precision matters, remember you're getting the floor (for positive numbers), and a 1.99 → 1 truncation can visibly change a resolution.

    • float (FLOAT) - the value to convert. Default 0, range 0 to a very large max (so the widget slider won't take you negative - type negatives in if you need them).

    One output: INT, the truncated value.

    Where it fits

    The classic use is feeding math into something that only speaks integers. Run Equation1param _O to compute x * 1.5, convert with floatToInt _O, and wire the result into a node that wants a batch count or an index. It also pairs with selectLatentFromBatch _O from the same pack - that node's index input is an INT, so if you're computing which latent in a batch to pick, this is how you feed it a computed value.

    The mirror image is intToFloat _O when something hands you an INT but the target wants FLOAT. Together they're the two most boring, most-used nodes in the pack.

    Installing it

    Ships in the Quality of Life Suit pack (omar92/ComfyUI-QualityOfLifeSuit_Omar92). Install via ComfyUI Manager (search "Quality of Life Suit") or clone:

    cd <ComfyUI>/custom_nodes
    git clone https://github.com/omar92/ComfyUI-QualityOfLifeSuit_Omar92.git
    

    Restart ComfyUI, not just a browser reload. No models, no dependencies for this node. The pack writes a config.json on first run with autoUpdate: true; set it to false if you don't want it pulling commits on startup.

    Common issues

    • "Why is 2.9 giving me 2?" Because it truncates, not rounds. That's Python's int(), and it's worth knowing before it bites you on a resolution calc. If you genuinely need rounding, round() isn't exposed here - compute it in Equation1param _O first (x + 0.5 and truncate does round-half-up for positives).
    • "The widget won't go below zero." The slider min is 0. Type a negative directly if you need it.
    • "My decimal vanished." Yes. That's the point of the node. The FLOAT output is gone; you're in integer land now. Keep a floatToText _O in mind if you need the original as a string elsewhere.

    Simple, one-line, and one of those nodes you'll silently thank on the day a workflow refuses to connect.

    CategoryO/numbers

    Inputs (1)

    NameTypeDefaultDescription
    floatFLOAT0.000–18446744073709550000

    Outputs (1)

    NameTypeDescription
    INTINT