Nodes/comfy-ovum/math Int Operation
ComfyUI Node

math Int Operation

The Ovum integer calculator that doesn't overthink it

By sfinktah·Created about a year ago·Updated 10 months ago· 7
math Int Operation
    • INT
    a0
    b0
    operation

    Two integers in, one integer out, six operations on a dropdown. math Int Operation is about as unglamorous as ComfyUI gets, and that's exactly what makes it useful. When you're building a counter, an index, or a loop accumulator and you just need a + b without hunting through a giant "Math Expression" node for the right syntax, this is the node you drop.

    It lives in the ovum/loop category of the comfy-ovum pack, which tells you where it belongs: alongside the IfElse, compare, and list nodes that make up Ovum's little logic toolkit. You mostly reach for it mid-workflow, between an upstream value and something that wants a computed integer - bumping a seed, computing a crop offset, or stepping an index.

    How it works

    The node is a thin wrapper over Python's own arithmetic. Feed it a and b, pick an operation, and it evaluates immediately. The six options are the plain ones:

    • add, subtract, multiply - what you expect
    • divide - integer division, so 7 / 2 gives 3, not 3.5
    • modulo - remainder, so 7 % 2 gives 1 (handy for wrapping indexes or cycling through a list)
    • power - a ** b

    That divide one is the gotcha worth remembering. There's no float result available anywhere in this node - everything in and out is INT. If you need a decimal, this isn't the tool; use a float-capable math node or feed Python String Format a float upstream.

    The inputs that matter

    All three are required and only one of them is interesting:

    • a and b - INT, default 0, range up to ±1.8e19 (so effectively "any integer you'll ever type"). Set them as widgets or wire them in from other nodes.
    • operation - the dropdown. The only thing you'll actually touch.

    Output: a single INT. Wire it straight into anything that wants a number - seeds, batch counts, steps, the index input on Get Value from List.

    Installing it

    math Int Operation ships in sfinktah/comfy-ovum, so you get the whole pack. In ComfyUI Manager, search comfy-ovum and install, or:

    cd ComfyUI/custom_nodes
    git clone https://github.com/sfinktah/comfy-ovum
    

    Then restart ComfyUI. The pack's requirements.txt is a handful of small pure-Python helpers (plus pymediainfo, which is guarded so a missing system library degrades video metadata rather than breaking the pack). No models to download - this is a logic pack, not a generation pack.

    One quirk of searching: the display name is "math Int Operation " with a trailing space, and the class name is all-lowercase. Just type ovum in the node menu and you'll find it.

    Where people get burned

    Mostly the integer division. People wire up a divide expecting 0.5 and get 0, then spend ten minutes blaming the node. It's fine - it's integer math, that's the spec. The other trap is expecting the pack's math nodes to be one big everything-node. Ovum keeps things granular: this does one operation at a time. Chain a few together if you need a real expression, or grab a dedicated expression evaluator if you need (a + b) * c in a single node. For the boring single-step arithmetic that most workflows actually need, this is the one I reach for.

    Categoryovum/loop

    Inputs (3)

    NameTypeDefaultDescription
    aINT0-18446744073709550000–18446744073709550000
    bINT0-18446744073709550000–18446744073709550000
    operationCOMBO6 options: add, subtract, multiply, divide, modulo, power

    Outputs (1)

    NameTypeDescription
    INTINT