Nodes/ComfyUI_BadgerTools/FloatToInt-badger
ComfyUI Node

FloatToInt-badger

Rounding is a workflow problem — this is the rounding node

By AbyssBadger0·Created 3 years ago·Updated 2 years ago· 8
FloatToInt-badger
    • INT
    float1.00

    FloatToInt-badger is one of the two nodes the pack author bothered to write a README line about ("float to int, rounded" - the whole README is two lines), and that tells you something: this is the pack's bread and butter. It takes a FLOAT and returns it rounded to the nearest integer. That's the entire node.

    It's absurdly simple, but it's the kind of node you suddenly need constantly. ComfyUI is full of places where one side of a connection demands an INT and the other side produces a FLOAT. Step counts, seeds, batch sizes, width/height, denoise * steps - any computed value that flows into an integer port will eventually bite you. Some nodes auto-coerce, some throw a type error, and some silently truncate in ways you didn't ask for. This node makes the conversion explicit and predictable.

    How it works

    One line of real logic: Python's round(). 1.49 → 1, 1.5 → 2. It rounds half up in the way you expect from school, not banker's rounding, which matters if you're feeding it values that land exactly on .5 - a 0.5 split will go up, not to the nearest even number.

    Inputs and outputs

    • float - the input FLOAT. Default 1.0, min 0, max 4096, with a 0.01 step.

    One output: an INT. That's it - wire it into anything with an INT port.

    The 4096 ceiling in the schema is worth a glance: if you're rounding a dimension or a large count that could exceed it, the widget just won't let you type higher. For anything reasonable like steps or seeds, you'll never notice.

    Installing it

    Part of ComfyUI_BadgerTools, installable from ComfyUI Manager (search "BadgerTools") or:

    cd ComfyUI/custom_nodes
    git clone https://github.com/AbyssYuan0/ComfyUI_BadgerTools
    

    Restart after install. No models. Yes, this node drags in the pack's heavy dependencies at startup - moviepy, open_clip, scikit-image and friends, none of which rounding needs - but that's the price of grabbing one node out of a grab-bag pack.

    When to use it (and when not to)

    Reach for it when a sampler or loader rejects your float and you want rounding, not truncation. Don't reach for it when you need flooring - 0.999 → 1 via round() when you wanted 0. If you need floor or ceiling semantics, a math/expression node is the better tool. And if a node accepts floats natively, feed it the float and skip this entirely; round only where the port demands it.

    It's also a handy place to run a value you want to see as an integer, because the node gives you a clean INT wire that feeds into display or filename-building utilities without surprises. No community drama here - it's a rounding node. It rounds. That's the review.

    Categorybadger

    Inputs (1)

    NameTypeDefaultDescription
    floatFLOAT1.000–4096

    Outputs (1)

    NameTypeDescription
    INTINT