ComfyUI Node

Number_AS

A float input that comes out as ComfyUI's loose 'number' type

By flyingshutter·Created 3 years ago·Updated about a year ago· 8
Number_AS
    • number
    value0.00

    Number_AS is a tiny passthrough with one job: you give it a FLOAT, and it outputs ComfyUI's loose number type instead. The value doesn't change; only the type label on the socket does. It's the least glamorous node in flyingshutter's As_ComfyUI_CustomNodes pack, and also the one that makes the most confusing ComfyUI type quirk slightly less confusing.

    How it works

    ComfyUI has three numeric types: INT (whole numbers), FLOAT (fractions allowed), and number - the loose one that accepts both. A number socket will happily accept an int or a float, and it's what a lot of custom nodes use for "some numeric parameter." The catch that motivates this node: the type system treats these as distinct, so a FLOAT output doesn't always plug cleanly into a number input, and vice versa.

    This node takes a FLOAT input and re-declares its output as number. Under the hood it's value in, value out - a literal one-line passthrough. It's the same trick as Number2Float_AS and Number2Int_AS from this pack (adapt the socket type without touching the data), just targeting the loose number type rather than a strict one.

    The inputs

    • value - a FLOAT (default 0, essentially unbounded range). Output: number.

    That's the entire interface. One input, one output.

    Where you'd use it

    ComfyUI's type strictness bites hardest with number-typed sockets on third-party nodes. If you're wiring a float from a math node or a slider into a custom node that declares its parameter as number, and ComfyUI is refusing the connection or behaving oddly about the type match, this node is the shim that makes it legal. It's also useful if you're building your own node templates and want a guaranteed number-typed wire coming out of a float source.

    Real talk: you'll reach for it occasionally, not constantly. But when a custom node's number input is being picky, it's the fastest fix that doesn't involve restructuring your graph. Its sibling Int2Any_AS covers the other end of the spectrum (int → ANY socket).

    Installing it

    cd ComfyUI/custom_nodes
    git clone https://github.com/flyingshutter/As_ComfyUI_CustomNodes
    

    Restart ComfyUI and it's under ASNodes (or ComfyUI Manager → "As_ComfyUI_CustomNodes"). No extra dependencies - this pack is deliberately dependency-free.

    Common issues

    • Expecting a conversion. There is none. It relabels the type; a 3.5 stays 3.5. If the downstream node actually needed a whole number, use Number2Int_AS instead.
    • Not every socket accepts number. Some nodes declare strict FLOAT or INT inputs, and a number output won't magically fit those either. Match the adapter to the destination's declared type.
    • Value-range surprises. The value input has no meaningful min/max, so you can feed huge numbers and they pass through - fine if intended, easy to misread as a clamp.

    It's a type label in node form. Boring, but exactly the kind of thing that keeps a workflow from breaking for no visible reason.

    CategoryASNodes

    Inputs (1)

    NameTypeDefaultDescription
    valueFLOAT0.00

    Outputs (1)

    NameTypeDescription
    numbernumber