π§ Simple Math Dual
Simple Math Dual (ComfyUI Essentials)
- a
- b
- c
- d
- int_1
- float_1
- int_2
- float_2
Two expressions, one node, sharing the same inputs. Simple Math Dual is what you want when you need to compute a pair of related numbers - width and height, or a value and its half - from the same source wires without dropping two separate Simple Math nodes into your graph. It's a small quality-of-life upgrade over the single version, and it earns its keep in dimension math.
Why you'd reach for it
So many ComfyUI calculations come in pairs. You've got an input width and you need both a scaled width and a scaled height. You've got a base resolution and you want a low-res pass and a high-res pass. With plain Simple Math you'd wire the same a, b, c inputs into two nodes and evaluate two strings - twice the boxes, twice the wiring. Simple Math Dual does both computations in one place off a shared set of variables, which keeps the graph tighter and, more importantly, keeps the two results locked to the same inputs. That's the kind of tidy-glue node the Essentials pack is full of.
How it works
It takes two expression strings, value_1 and value_2, and up to four shared variables, a through d. Both expressions can use any of those variables, so value_1 = a * b and value_2 = a * c read from the same a. It evaluates each string independently and gives you both answers. Note it offers four variables to the single node's three - the extra one is there precisely because two formulas tend to want more inputs between them.
Inputs and outputs
Required: value_1 and value_2, the two expression strings. Optional: a, b, c, d, the numeric variables (loosely typed, so any number fits). Four outputs, one pair per expression: int_1 / float_1 from value_1, and int_2 / float_2 from value_2. As with Simple Math, you get each result as both an integer and a float - grab INT for sizes and counts, FLOAT for strengths and ratios.
Installing it
Comes with ComfyUI Essentials by cubiq (Matteo Spinelli, the person behind the IPAdapter nodes and the Latent Vision channel). ComfyUI Manager: search ComfyUI Essentials, install, restart. Or:
cd ComfyUI/custom_nodes
git clone https://github.com/cubiq/ComfyUI_essentials
then restart. It's π§ Simple Math Dual under essentials/utilities, class SimpleMathDual+. Maintenance-only pack since April 2025, no concern for a node this stable.
Common issues
Same INT-truncation gotcha as its single sibling: an expression that produces a fraction gives a rounded-down integer on the int_* output and the true value on the float_* output, so pull from the float wire when the decimals matter. Keep to the aβd variables; other names won't resolve. And use the right tool for the job - if you only need one result, plain Simple Math is less clutter; if you need three or more related values, you're probably better structuring the graph than stacking dual nodes.
Inputs (6)
| Name | Type | Default | Description |
|---|---|---|---|
| value_1 | STRING | β | |
| value_2 | STRING | β | |
| aopt | * | 0 | β |
| bopt | * | 0 | β |
| copt | * | 0 | β |
| dopt | * | 0 | β |
Outputs (4)
| Name | Type | Description |
|---|---|---|
| int_1 | INT | β |
| float_1 | FLOAT | β |
| int_2 | INT | β |
| float_2 | FLOAT | β |