Nodes/SeargeSDXL/Integer Math
ComfyUI Node Runs on cloud

Integer Math

A five-operation calculator node for integers

By SeargeDP·Created 3 years ago·Updated 2 years ago· 874
Integer Math
    • result
    opa * b + c
    a0
    b1
    c0

    A pocket calculator for whole numbers, wired into your workflow. Pick an operation, plug in up to three integers, and it outputs the result. The default operation is a * b + c, which tells you what this is really for: computing dimensions, step counts, or offsets from other values in a procedural graph, rather than hard-coding a number that breaks the moment you change something upstream.

    It's part of the pack's older utility set (Searge/_deprecated_/Integers), a handful of little arithmetic nodes Searge shipped so a workflow could derive its own numbers. Most people running the stock workflow never touch these - they're for the folks building custom graphs who want one value to follow from another.

    How it works

    You choose an operation from a five-item list, and the node applies it to the inputs a, b, and c:

    • a * b + c - multiply-then-add, the default (great for "base × scale + padding").
    • a + c, a - c - simple add and subtract.
    • a * b - multiply.
    • a / b - divide (integer division, so the result is truncated to a whole number).

    The output is a single INT, ready to feed any integer socket downstream.

    The inputs and outputs that matter

    • op - which of the five operations to run.
    • a, b, c - the operands. Which ones matter depends on the operation: a + c ignores b, a * b ignores c, and so on.
    • result (output) - the computed INT.

    There's nothing hidden here. Note that b defaults to 1, which keeps a * b + c well-behaved (you get a + c) until you set it.

    When you'd actually use it

    This is glue for workflow authors. Say your hi-res pass should be base_steps × 2 plus a couple of prep steps - you'd feed that through here rather than typing a fixed number that goes wrong when you change base steps. Or you're computing a resolution as a multiple of a tile size. It's not exciting, but it's the difference between a workflow that adjusts itself and one you have to hand-edit in five places every time you tweak a setting. If you're not building that kind of graph, you can safely ignore this node exists.

    How to install it

    ComfyUI Manager: search SeargeSDXL, install, restart. Manual: python -m pip install opencv-python in ComfyUI's Python env first (the pack needs it), then cd ComfyUI/custom_nodes && git clone https://github.com/SeargeDP/SeargeSDXL.git, restart. Windows portable has an installer script.

    No models - it's arithmetic.

    Where people get burned

    • Integer division truncates. a / b throws away the remainder: 7 / 2 gives 3, not 3.5. If you need rounding-with-scaling, SeargeIntegerScaler is the better tool.
    • Ignoring which operands the op uses. Setting b when the operation is a + c does nothing. Match your inputs to the chosen op.
    • Reaching for it unnecessarily. It's deprecated plumbing. Unless you're wiring a self-adjusting graph, the stock workflow already handles its own numbers.
    CategorySearge/_deprecated_/Integers

    Inputs (4)

    NameTypeDefaultDescription
    opCOMBOa * b + c5 options: a * b + c, a + c, a - c, a * b, a / b
    aINT00–18446744073709550000
    bINT10–18446744073709550000
    cINT00–18446744073709550000

    Outputs (1)

    NameTypeDescription
    resultINT