Nodes/ComfyAngel/ComfyAngel_MathInt
ComfyUI Node

ComfyAngel_MathInt

Integer arithmetic that lives inside your graph

By ThepExcel·Created 8 months ago·Updated about a month ago· 14
ComfyAngel_MathInt
    • INT
    a0
    b0
    operation

    ComfyAngel_MathInt does exactly what it says: integer math. Two integer inputs, a and b, one of five operations - add, subtract, multiply, divide, modulo - and one INT output. It's the pack's internal calculator, and its day job is keeping loops moving: every ComfyAngel loop uses it to add 1 to the current index and decide whether to keep iterating.

    What it actually computes

    The operations are plain integer arithmetic, with two details worth knowing because they bite:

    • divide is floor division, not float. 7 / 2 gives you 3, not 3.5. If you need fractions this is the wrong node - that's what a float math node is for.
    • Division and modulo by zero return 0 instead of raising. That's a deliberate guard, but it's also a silent one: a zero denominator won't crash your graph, it'll just quietly produce a 0. If you see a 0 that makes no sense, check the divisor.

    Both inputs default to 0 and are plain INT, so you can type values or convert a widget to input and wire them from elsewhere. The single output is a real INT, ready for any integer socket.

    When you'd actually use it

    It's hidden from the node menu (deprecated, internal), so it enters your life in two ways: automatically inside every loop, or by loading a workflow that contains one. But it's genuinely handy when you do want it: increment a counter, compute width - margin, double a value before feeding an Empty Latent, or turn a batch index into a filename number. Enable "Show deprecated" in search and it's right there, alongside the pack's Compare and GetLength, as a tiny arithmetic toolkit.

    The honest framing: this is a one-liner node that exists to serve the loop machinery, and ComfyUI has a dozen math nodes from bigger packs if you want the full operator zoo. What MathInt has going for it is being part of ComfyAngel's own, well-tested loop path - if you're building custom loop logic and want exactly the operations the pack's own code uses, this is the one that's guaranteed compatible.

    Installing it

    cd ComfyUI/custom_nodes
    git clone https://github.com/ThepExcel/ComfyAngel.git
    

    Restart ComfyUI, or search "ComfyAngel" in ComfyUI Manager. Pillow is the only dependency - nothing to download, no models.

    Bottom line: integer add/subtract/multiply/floor-divide/modulo, with a "don't crash on zero" guard that you should know about. Small, predictable, and already inside every loop you've run.

    CategoryComfyAngel/Loop/Internal

    Inputs (3)

    NameTypeDefaultDescription
    aINT0
    bINT0
    operationCOMBO5 options: add, subtract, multiply, divide, modulo

    Outputs (1)

    NameTypeDescription
    INTINT