Nodes/ComfyUI-JakeUpgrade/Evaluate Ints JK๐Ÿ‰
ComfyUI Node

Evaluate Ints JK๐Ÿ‰

Evaluate Ints JK, with a free INT/FLOAT/STRING conversion

By jakechaiยทCreated 2 years agoยทUpdated 3 months agoยท 146
Evaluate Ints JK๐Ÿ‰
    • INT
    • FLOAT
    • STRING
    โ—„python_expression((a + b) - c) / 2โ–บ
    โ—„a0โ–บ
    โ—„b0โ–บ
    โ—„c0โ–บ

    Integer math in ComfyUI is a chore. Want to compute a frame count, a crop offset, or a steps value that depends on two other ints? That's three chained math nodes and a conversion on top. Evaluate Ints JK collapses it into one expression - write a + b * c, plug in the integers, and read the answer off as INT, FLOAT, and STRING all at once. It's the node you reach for when you find yourself building a four-node ladder just to compute 81 * (something + 1).

    It runs on SimpleEval, same as the rest of the Evaluate family: your expression evaluates with a, b, c bound to the three integer inputs, and the whitelist gives you arithmetic, %, //, **, bitwise operators, comparisons, abs, min, max. The variable range is huge (basically int64), and the step is 1.

    What you actually configure:

    • python_expression - required. Default ((a + b) - c) / 2, which is a decent template and a warning sign in one: note it's integer input producing a possibly-fractional float.
    • a, b, c - optional ints, default 0. Connect the ones your expression uses; unconnected inputs silently evaluate as 0.

    The trap that will bite you: the INT output is int(result) of the float result. If your expression does division and produces 2.5, the INT output says 2 - truncation, not rounding. When the exact value matters, put round() in the expression or use the FLOAT output. Second trap: the FLOAT output is the "true" result, not the int one. People grab the INT output assuming it's the canonical answer, then wonder why downstream math disagrees. If your expression is pure integer math (a + b * c), INT and FLOAT agree; the moment you divide, they don't.

    Install. It's in ComfyUI-JakeUpgrade:

    cd ComfyUI/custom_nodes
    git clone https://github.com/jakechai/ComfyUI-JakeUpgrade
    cd ComfyUI-JakeUpgrade
    pip install -r requirements.txt
    

    Or ComfyUI Manager โ†’ "JakeUpgrade". Windows portable: install.bat or ../../../python_embeded/python.exe -s -m pip install -r requirements.txt. Restart. The simpleeval dependency installs automatically; nothing heavy.

    Gotchas: division-by-zero raises a clean ValueError - check that every variable you reference is actually connected. And while the input range is generous, don't assume the UI shows it; the field min/max are enormous, so an out-of-range value from another node will error rather than clamp. Pack rules: LOAD_DEPRECATED_NODES = True if JK nodes report missing, and disable ComfyUI MultiGPU per the README for CUDA-error avoidance.

    Category๐Ÿ‰ JK/โœ–๏ธ Math

    Inputs (4)

    NameTypeDefaultDescription
    python_expressionSTRING((a + b) - c) / 2Python expression using variables a, b, c (e.g., 'a + b * c')
    aoptINT0-18446744073709550000โ€“18446744073709550000Integer variable a for expression
    boptINT0-18446744073709550000โ€“18446744073709550000Integer variable b for expression
    coptINT0-18446744073709550000โ€“18446744073709550000Integer variable c for expression

    Outputs (3)

    NameTypeDescription
    INTINTโ€”
    FLOATFLOATโ€”
    STRINGSTRINGโ€”