Nodes/Boyonodes/Boyo Math Int
ComfyUI Node

Boyo Math Int

Integer Math for When Your Loop Math Stops Being Mental

By DragonDiffusionbyBoyo·Created 2 years ago·Updated 26 days ago· 16
Boyo Math Int
    • INT
    a0
    b0
    operation

    The moment your ComfyUI graph stops being a straight line and starts being a loop, you need arithmetic that runs inside the graph - and that's where BoyoMathInt earns its keep. It's a tiny node: two integers in, one integer out, with a dropdown choosing the operation. Nothing about it is glamorous. What it saves you is the misery of hand-computing frame offsets every time you change a chunk size in a video loop.

    What it does

    Feed it a and b plus one of six operations:

    • add / subtract / multiply - the obvious ones
    • divide - integer (floor) division, not float
    • modulo - remainder, great for wrap-around logic
    • power - a raised to b

    Output is a single INT. Because it's just a number, you can chain it, or drive it from a loop counter to compute things like frames_processed = counter * chunk_size + offset - the same calculation the pack's Boyo Frame Counter exists for, except this one is general.

    The trap that will bite you

    divide is floor division (a // b in Python), so 5 / 2 returns 2, not 2.5. That's almost always what you want for frame math - you can't have half a frame - but if you're porting a formula from a calculator, it'll quietly round down. And division by zero will throw and kill the queue, so clamp your inputs if they can plausibly be zero.

    Where it fits

    BoyoMathInt lives in the pack's loop toolkit, alongside BoyoPromptLoop, BoyoOverlapSwitch and the while/for loop nodes. Typical wiring: a loop counter feeds a, your chunk size feeds b, and the result feeds a video combine or a latent switch that needs a frame offset. You can also use it standalone for any integer computation you'd rather not do in your head - e.g. modulo to cycle a seed, or power for a quick resolution multiplier.

    Installing it

    It's part of Boyonodes, so install the pack once:

    cd ComfyUI/custom_nodes
    git clone https://github.com/DragonDiffusionbyBoyo/Boyonodes
    

    Restart ComfyUI (or use ComfyUI Manager, search "Boyonodes"). This node has zero extra dependencies - pure integer arithmetic. If ComfyUI Manager tries to install the pack's full, heavy requirements.txt (which exists for the TTS and voice nodes), you can safely ignore failures there; Math Int runs regardless.

    Bottom line

    Is it a node you'll blog about? No. Is it the difference between guessing a frame count and computing it? Yes. If you're building looped video workflows, throw it in next to your counter and never reach for a calculator again.

    CategoryBoyo/Logic/Math

    Inputs (3)

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

    Outputs (1)

    NameTypeDescription
    INTINT