Evaluate Ints JK๐
Evaluate Ints JK, with a free INT/FLOAT/STRING conversion
- INT
- FLOAT
- STRING
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.
Inputs (4)
| Name | Type | Default | Description |
|---|---|---|---|
| python_expression | STRING | ((a + b) - c) / 2 | Python expression using variables a, b, c (e.g., 'a + b * c') |
| aopt | INT | 0-18446744073709550000โ18446744073709550000 | Integer variable a for expression |
| bopt | INT | 0-18446744073709550000โ18446744073709550000 | Integer variable b for expression |
| copt | INT | 0-18446744073709550000โ18446744073709550000 | Integer variable c for expression |
Outputs (3)
| Name | Type | Description |
|---|---|---|
| INT | INT | โ |
| FLOAT | FLOAT | โ |
| STRING | STRING | โ |