Nodes/Comfyroll Studio/πŸ”§ CR Float To Integer
ComfyUI Node Runs on cloud

πŸ”§ CR Float To Integer

Convert a float to an int in ComfyUI

By Suzie1Β·Created 3 years agoΒ·Updated 2 years agoΒ· 1,296
πŸ”§ CR Float To Integer
    • INT
    • show_help
    β—„_float0.00β–Ί

    ComfyUI is strict about types. A node that outputs a FLOAT can't plug into an input that expects an INT - ComfyUI won't quietly cast it for you, it just refuses to connect. CR Float To Integer is the tiny adapter that fixes that: feed it a float, get a whole number out, wire it wherever an INT is required.

    It's a one-job conversion node in Comfyroll Studio, the utility pack from Suzie1 and RockOfFire. Dead simple, and it exists purely because of ComfyUI's type system - not because the math is hard.

    When you'd reach for it

    Anytime a float-producing node needs to drive an integer input. A gradient or math node hands you 14.0 and your sampler's steps wants an INT. A calculation yields a fractional dimension and a resize node wants whole pixels. A CR Gradient Float ramp needs to become a frame count. This node is the glue in all of those.

    The inputs and outputs

    • _float - the value to convert. (Yes, the parameter really is named with a leading underscore - that's just how it's exposed.)
    • Output INT - the whole-number result, plus show_help, a wiki-link string you can ignore.

    That's the entire node. There's no rounding-mode option, so if the exact behavior at the boundary matters to you - whether 3.9 becomes 3 or 4 - test it with a known value before you rely on it, and if you specifically need rounding, do the arithmetic upstream (e.g. add 0.5 before converting).

    Installing it

    ComfyUI Manager β†’ search Comfyroll Studio β†’ install β†’ restart. Or by hand:

    cd ComfyUI/custom_nodes
    git clone https://github.com/Suzie1/ComfyUI_Comfyroll_CustomNodes
    

    then restart. The utility nodes have no heavy dependencies and nothing to download.

    Common issues

    It won't connect to the target. Confirm the downstream input actually wants an INT - some nodes accept a FLOAT directly, in which case you don't need this at all.

    Unexpected value at the decimal boundary. As noted, there's no rounding widget. If you're near a .5 and precision matters, handle the rounding in a math node before this one.

    The whole pack failed to load. If ComfyUI's console shows Comfyroll's utility nodes failing with a NameError (the pack's graphics module can fail to import and drag the entire pack down with it), that's not this node - it's a missing dependency elsewhere in the pack. Scroll up to the first real traceback, install the missing library into ComfyUI's Python, and restart.

    Category🧩 Comfyroll Studio/πŸ› οΈ Utils/πŸ”§ Conversion

    Inputs (1)

    NameTypeDefaultDescription
    _floatFLOAT0.00β€”

    Outputs (2)

    NameTypeDescription
    INTINTβ€”
    show_helpSTRINGβ€”