Nodes/mewins_node_pack/Int Operation
ComfyUI Node

Int Operation

Integer arithmetic with a division quirk you'll want to know about

By efuentesamin·Created 7 months ago·Updated 7 months ago· 0
Int Operation
    • result
    operand_a
    operand_b
    operator

    Where Float Operation handles the fractional stuff, Int Operation is its integer sibling - and INT is ComfyUI's language for things you count. Batch sizes, step counts, seeds, tile numbers. When a workflow needs "twice the batch" or "half the steps," that's integer math, and that's this node's whole job.

    It works exactly like Float Operation: a Python match statement over a +, -, *, / dropdown, two numbers in, one number out. The interesting part is how division behaves. The code computes int(operand_a / operand_b) - it divides as floats, then truncates toward zero. So 7 / 2 gives 3, not 3.5. And -7 / 2 gives -3 - which is not floor division (that would give -4). Truncation, not flooring. If you're comparing step math across nodes or scripts, that distinction occasionally bites.

    The inputs that matter:

    • operand_a, operand_b - the two INT values. Type them or wire them from an INT output (seed, batch size, step count).
    • operator - the dropdown: +, -, *, /.

    Output is a single result (INT). Wire it into any INT input - KSampler steps, batch_size, seed arithmetic, tile counts for an upscaling pass. Division is the one you'll actually reach for: "run at half the steps" is just steps / 2. Just remember you lose the remainder, so for finer control you want the pack's float node (or its Int-to-Float converter) and rounding later.

    Installing it

    Same as the rest of the pack - ComfyUI Manager, search "Mewins Node Pack", install, restart. Or manually:

    cd ComfyUI/custom_nodes
    git clone https://github.com/efuentesamin/mewins_node_pack
    

    No dependencies to pip and no model files to download - pyproject.toml lists zero runtime deps. The one requirement that can trip you: the pack declares Python >= 3.12, so a ComfyUI running on 3.10/3.11 may fail the version check at install.

    Gotchas

    • Division by zero is unguarded. Set operand_b to 0 with / selected and the node raises ZeroDivisionError, killing the run. It's the classic "why did my graph die" culprit in this pack.
    • Truncation silently drops the remainder. 7 / 2 = 3. If you actually wanted 3.5, you're in the wrong node.
    • One operator at a time. Chained math means stacking nodes or using core MathExpression.

    Context worth having: this is a small, single-commit pack whose README is still boilerplate ("A list of features"). Don't expect an ecosystem staple - but for one visible integer operation, it does exactly what it says, with zero dependencies to fight and no model downloads lurking.

    CategoryMewins Node Pack

    Inputs (3)

    NameTypeDefaultDescription
    operand_aINT
    operand_bINT
    operatorCOMBO4 options: +, -, *, /

    Outputs (1)

    NameTypeDescription
    resultINT