Nodes/Pseudocomfy/Float to Int
ComfyUI Node

Float to Int

Rounding, flooring, ceiling — one widget instead of a script

By Pseudotools·Created 2 years ago·Updated 20 days ago· 4
Float to Int
    • int
    val
    roundinground

    ComfyUI is picky about types in a way that drives new users up the wall: a FLOAT will not silently slide into an INT socket, and plenty of nodes - dimensions, seeds, batch counts, step counts - demand integers. Float to Int is the two-second fix. It takes any float on a wire and hands you back an integer, choosing how to round.

    That's the whole node, and that's fine. The useful part is the rounding dropdown, because "convert to int" is a lie until you decide which int. Pick from:

    • round (default) - standard rounding, 2.6 → 3, 2.4 → 2.
    • floor - always down, 2.9 → 2. This is the one you want when a value must never exceed a limit, like fitting into a resolution cap.
    • ceil - always up, 2.1 → 3. The one you want when you must never go under, like guaranteeing a minimum canvas size.

    Input val is a FLOAT with forceInput, so it has to arrive over a wire - you can't just type into it, which is intentional. It's meant to sit downstream of anything that computes a number, like the scaled_width/scaled_height outputs of PseudoProcessImagePrompt or PseudoProcessMaterialPrompts, whose dimensions can land on awkward fractional values. A width output of 832.0 going into a KSampler's width INT socket would normally refuse to connect; a quick hop through this node and you're done. The single output, int, is a proper INT.

    Honest caveats

    • There's no clamp - floor/ceil/round won't push the value into a sane range. Round first, then clamp elsewhere if your downstream node cares.
    • It's one float at a time. If you need to convert a whole list, you'll be looping nodes, and at that point a tiny custom script might be cleaner.

    It's the kind of node you forget exists until the exact moment you need it. Every workflow that chains Pseudocomfy's processing nodes eventually hits a type mismatch, and when you do, this is the fastest way out - no math nodes, no PrimitiveNode gymnastics. It's also free: it ships with the pack, so there's nothing extra to install beyond the usual clone-and-restart (git clone https://github.com/Pseudotools/Pseudocomfy into custom_nodes, or Manager → "Pseudocomfy").

    CategoryPseudocomfy/Utils

    Inputs (2)

    NameTypeDefaultDescription
    valFLOAT
    roundingCOMBOround3 options: round, floor, ceil

    Outputs (1)

    NameTypeDescription
    intINT