Equation1param _O
A tiny calculator hiding in your graph
- FLOAT
- int
Some of the most common ComfyUI workflows involve a number you wish you could just derive - a denoise strength that's always base * 0.8, a step count that's width / 8, an upscale factor with an offset. Equation1param _O is the node that computes it for you inside the graph: you give it a value x and an equation, it evaluates the equation and hands you the result as both a FLOAT and an INT.
It comes from the O/numbers folder of the Quality of Life Suit pack, and it's the single most "underrated math" node in the set. ComfyUI gives you bare widgets everywhere, but almost never gives you "take this value and transform it by a formula" as a first-class operation. This is that operation, minus the ceremony.
How it works
The mechanism is worth understanding because it's both simple and a little sharp-edged. The node takes your equation string and runs it through Python's eval() after substituting your x value into it: the source replaces every x with (x) and evaluates the result. So x*2+1 with x=4 becomes 4*2+1 = 9. Because it's eval, you can use standard Python operators and builtins - abs(x), x**2, min(x, 10) all work.
x(FLOAT) - the variable. Default 0, and it accepts wire input so it can come from another node.equation(STRING, multiline) - the formula. Defaultx*1. Write it withxas the placeholder.
Two outputs, same computed value in both flavors:
FLOAT- the exact result.int- the result truncated to an integer viaint(). Remember: truncation, not rounding, so2.9gives you2.
Where it fits
The killer pattern is a reusable math pipeline: int _O or float _O → Equation1param _O → the node that needs a derived value. Feeding your width into x/8 gives you a batch-count hint; feeding a base strength into x*0.5+0.1 gives you a real denoise value instead of a vibe. It's also handy for resolution math around upscaling - computing a target before you hit a scaling node.
One honest caution: there's no Python math namespace loaded, so math.sqrt(x) will fail - you're limited to builtins. And if you feed it garbage, the source catches the error, prints equation is not valid to the console, and returns the string "NAN" - which then breaks the int() conversion with an exception. So: keep equations simple and valid. This is a calculator, not a scripting engine.
Installing it
Ships in the Quality of Life Suit pack (omar92/ComfyUI-QualityOfLifeSuit_Omar92). Install via ComfyUI Manager (search "Quality of Life Suit") or clone:
cd <ComfyUI>/custom_nodes
git clone https://github.com/omar92/ComfyUI-QualityOfLifeSuit_Omar92.git
Restart ComfyUI properly. No models, no dependencies. The pack writes a config.json on first run with autoUpdate: true, so it may pull new commits at startup - set it to false if you want the folder stable.
Common issues
- "It crashes on a bad equation." Known behaviour - an invalid expression returns
"NAN"and the INT output then throws. Validate your formula before queueing. - "
math.sqrtdoesn't work." Nomathmodule in scope. Use builtins, or pre-compute the hard part outside ComfyUI. - "The INT output is off by one." That's truncation biting you on something like
x*1.5. Add+0.5before converting if you want round-half-up.
The two-input "x" node is the one you'll actually remember; the two-variable version (Equation2params _O) exists for the days when one value just isn't enough.
Inputs (2)
| Name | Type | Default | Description |
|---|---|---|---|
| x | FLOAT | 0.000–18446744073709550000 | — |
| equation | STRING | x*1 | — |
Outputs (2)
| Name | Type | Description |
|---|---|---|
| FLOAT | FLOAT | — |
| int | int | — |