Nodes/smn_support_nodes/[SSN] Convert Float To Others
ComfyUI Node

[SSN] Convert Float To Others

One float in, three useful shapes out — string, truncated, rounded

By SummonTheCat·Created about a year ago·Updated about a year ago· 0
[SSN] Convert Float To Others
    • string
    • int_base
    • int_round
    ◄float0.00►

    [SSN] Convert Float To Others takes one float and gives you three versions of it: string, int_base, and int_round. It's the pack's answer to "I have a number and three different nodes want it in three different forms."

    The outputs are exactly what they sound like. string is the float written out as text - 12.5 becomes "12.5" - for filename savers, note nodes, or anything that builds strings. int_base truncates the decimal: 12.9 becomes 12. int_round rounds to the nearest whole number: 12.5 becomes 13. The distinction between the last two is the whole reason the node has both, and it's the kind of subtle difference that produces "why is my size off by one" bugs if you're not careful - pick truncation when you mean "floor at the decimal," rounding when you mean "closest integer."

    This is plumbing, through and through - a converter that exists because ComfyUI's type system is strict and won't let a FLOAT slide into an INT socket. The plumbing-layer reality is that you hit this constantly: a sampler outputs or a widget holds a float, and downstream a width, a frame count, or a seed wants an integer. You can reach for a generic number-conversion node from another pack, but this one has the nice property of giving you all three shapes off a single input, so one wire fans out to everything.

    Mechanically it's a passthrough with Python's built-in int() and round() applied - no rounding mode tricks, no banker's rounding games, just Python defaults. The input is a FLOAT widget with a 0.01 step and a ±1,000,000 range, which covers realistic uses.

    The honest take: it's nothing you couldn't do with a tiny Python node or a couple of core converters, but if you're already running smn_support_nodes for its draw/prep tools, this keeps your graph tidy and dependency-light. When I need a float → string for a filename and a float → int for a dimension at the same time, this is the one node that does both in a single step.

    Install

    Part of smn_support_nodes by SummonTheCat. ComfyUI Manager → search smn_support_nodes → Install → restart, or:

    cd ComfyUI/custom_nodes
    git clone https://github.com/SummonTheCat/smn_support_nodes
    

    Restart required. Dependencies (opencv-python, imageio-ffmpeg) auto-install; no models.

    Troubleshooting

    Low-stakes node, so issues are rare. If a downstream node rejects the string output, check whether it wants a JSON-encoded string (quotes) versus a bare one - this node emits bare text. And remember int_base truncates, so if you expected 2.99 → 3 you want int_round, not int_base. If the float widget isn't letting you type enough precision, that's the 0.01 step fighting you; the value itself is stored at full float precision internally.

    CategoryConverter

    Inputs (1)

    NameTypeDefaultDescription
    floatFLOAT0.00-1000000–1000000—

    Outputs (3)

    NameTypeDescription
    stringSTRING—
    int_baseINT—
    int_roundINT—