Nodes/fxai-toolkit/凤希AI - 整数转小数
ComfyUI Node

凤希AI - 整数转小数

One wire, both numbers out

By fxai666·Created 4 months ago·Updated 4 days ago· 35
凤希AI - 整数转小数
    • 小数
    • 整数
    输入整数0

    ComfyUI's type system is strict about sockets: an INT input won't accept a FLOAT wire and vice versa, and the second you chain a batch counter into a node that wants a float - a strength, a CFG, a scale factor - the graph refuses to connect. FxAiIntToFloat is the two-cent bridge that fixes it. Feed it an 输入整数 and it hands you the same number as a 小数 (float), plus the original 整数 passed through. One node, both representations, no fiddling.

    It's the kind of node that feels pointless until the exact moment it isn't - which is to say, every time you've tried to wire an index into a strength input and stared at a red socket. It's also the pack's philosophy in miniature: the README lists "数据类型转换节点" (data-type conversion) as a first-class feature of its low-VRAM optimization story, because type mismatches are how tiny, maddening bugs get into long pipelines.

    How it works

    输出小数 = float(输入整数), then both values are returned. The conversion is a plain Python cast, so 7 becomes 7.0 - no rounding, no precision drama (integers convert cleanly to floats in this range; the input is capped at ±9,999,999, well within float's exact-integer territory). Both outputs come from the single 输入整数 (INT, default 0).

    Inputs and outputs

    • 输入整数 (INT, −9,999,999 to 9,999,999) - the source.
    • 小数 (FLOAT) - the same value as a float, for FLOAT sockets.
    • 整数 (INT) - the value passed through unchanged, for when the same number also needs to feed an INT socket.

    Installing it

    Part of fxai-toolkit (凤希AI, MIT). Install via ComfyUI Manager (search "fxai-toolkit") or:

    cd ComfyUI/custom_nodes
    git clone https://github.com/fxai666/fxai-toolkit
    # restart ComfyUI
    

    No models. The pack auto-installs soundfile and psutil on first load. Chinese labels; support via the author's QQ group (775649071) and Bilibili.

    Where people get burned

    Not much to burn on here - it's a cast. The only real gotcha is using it as a value source instead of a bridge: the float output will always be a whole number (like 7.0), so don't reach for this when you need a fractional constant - that's what the pack's float-input node is for. And note it converts in one direction only: for float→int you'd want the reverse (or just use an int widget, since ComfyUI rounds widget floats to ints for you). In a pinch this node plus one float-input node covers most numeric plumbing.

    Category凤希AI/工具

    Inputs (1)

    NameTypeDefaultDescription
    输入整数INT0-9999999–9999999

    Outputs (2)

    NameTypeDescription
    小数FLOAT
    整数INT