Nodes/ComfyMath/IntToNumber
ComfyUI Node

IntToNumber

Feed an integer into ComfyMath's own math nodes

By evanspearman·Created 3 years ago·Updated about a year ago· 192
IntToNumber
    • NUMBER
    a0

    IntToNumber is glue, and it's worth understanding why it needs to exist at all. ComfyMath doesn't just work with ComfyUI's native INT and FLOAT sockets - it also defines its own generic type, NUMBER, which its NumberBinaryOperation and NumberUnaryOperation nodes use so one set of math nodes can handle either integers or floats without you needing a separate "IntAdd" and "FloatAdd" for every operation. IntToNumber is the on-ramp: it takes a plain INT and converts it into that internal NUMBER type.

    You want this specifically when you're building a calculation chain out of ComfyMath's NUMBER-typed nodes and one of your starting values happens to be a whole number rather than a decimal - say, a batch size or a seed you want to run through the same generic math chain as everything else.

    How it works

    a (INT, default 0) goes in, NUMBER comes out. No options to set - it's a pure type conversion, not a math operation, so nothing about the value itself changes.

    The inputs and outputs that matter

    • a - the integer to convert.
    • Output - NUMBER, ComfyMath's own generic numeric type. It plugs into any other ComfyMath node's NUMBER socket (NumberBinaryOperation, NumberUnaryOperation), not into a plain FLOAT or INT input elsewhere in your graph.

    Installing it

    Search ComfyMath in ComfyUI Manager, or:

    cd ComfyUI/custom_nodes && git clone https://github.com/evanspearman/ComfyMath
    

    then restart ComfyUI. No pip dependencies beyond what ComfyUI already has, no model files to fetch - the pack is a handful of Python files.

    Common issues

    The confusion this node runs into isn't a bug, it's the type system. NUMBER is a ComfyMath-specific socket - it will not connect to a generic FLOAT or INT input on some other pack's node, even though conceptually a number is a number. If you're wondering why you can't wire a NumberBinaryOperation's output straight into a KSampler's steps input, that's why: you need to convert back out (with something like FloatToInt) once you're done doing math in NUMBER-land.

    Given how much less traffic this node gets than its FloatToInt/IntToFloat siblings, most people building a quick calculation just reach for the plainer IntBinaryOperation or FloatBinaryOperation instead and never touch NUMBER at all - a perfectly reasonable choice unless you specifically need to mix int and float values through the same chain of operations without converting at every single step.

    As with the rest of the pack, ComfyMath has had no active maintainer since around early 2024 by community accounts, but because it's simple arithmetic with no external calls or model weights, that's had essentially no practical impact - it just means the node is unlikely to change or gain features going forward.

    Categorymath/conversion

    Inputs (1)

    NameTypeDefaultDescription
    aINT0

    Outputs (1)

    NameTypeDescription
    NUMBERNUMBER