Nodes/ComfyUI Easy Use/easy simpleMath
ComfyUI Node Runs on cloud

easy simpleMath

Type a formula, get a number back

By yolain·Created 3 years ago·Updated 8 days ago· 2,633
easy simpleMath
  • a
  • b
  • c
  • int
  • float
  • boolean
value

Sometimes you just need to do arithmetic in the middle of a graph - halve a width, multiply a step count, add an offset to a seed - and you don't want to chain five separate add/multiply nodes to get there. easy simpleMath lets you type a formula as a string, wire in up to three values, and get the result out as an int, a float, or a boolean. It's the little calculator node that turns "I need this dimension to be a third of that one" into one box instead of a subgraph.

How it works

You write an expression in the value field using a, b, and c as variables, and the node evaluates it against whatever you've plugged into those inputs. So a * 2, (a + b) / 2, a // 8 * 8 (round down to a multiple of 8 - genuinely useful for resolutions), or a > b all work. The result comes out simultaneously as three types, so you grab whichever one the next node expects. It's a fresh addition to the pack (added in v1.3.6 alongside the other string/list helpers), and it replaces a whole category of single-operation math nodes with one flexible one.

The inputs and outputs that matter

  • value - the expression string. This is the node. Reference your inputs as a, b, c; use normal operators (+ - * / // % **) and comparisons.
  • a, b, c (optional, type *) - the values the expression operates on. Wire in whatever numbers you're computing from - an image width, a loop index, a step count. You only need to connect the ones your formula uses.

Outputs are the same result in three forms: int, float, and boolean. Pull int for a resolution or step count, float for a strength or ratio, boolean for a comparison result you want to feed into a switch.

Installing it

Bundled with the pack. Install ComfyUI-Easy-Use via ComfyUI Manager (search ComfyUI Easy Use, restart) or:

cd ComfyUI/custom_nodes
git clone https://github.com/yolain/ComfyUI-Easy-Use

Install requirements, restart. Note this node arrived in a recent version, so if it's missing from your node list, update the pack - that's the fix, not a reinstall.

Where it bites

The main gotcha is type expectations downstream. All three outputs are always populated, so it's on you to pull the right one: feeding the float output into a node that wants an integer (like a step count or dimension) can error or get silently truncated. When a formula should yield a whole number, take the int output - and if you need it rounded to a multiple (ComfyUI resolutions like being divisible by 8 or 64), bake that into the expression with // rather than hoping the truncation lands where you want.

The other thing: keep the expression simple, as the name promises. It's meant for quick arithmetic on a few values, not for building a scripting layer inside your graph. If you catch yourself writing something long and branchy, that's a sign the logic belongs somewhere else. For its actual job - small, on-the-fly calculations so your dimensions and counts stay in sync - it's exactly right and saves a lot of node clutter.

CategoryEasyUse/Logic/Math

Inputs (4)

NameTypeDefaultDescription
valueSTRING
aopt*
bopt*
copt*

Outputs (3)

NameTypeDescription
intINT
floatFLOAT
booleanBOOLEAN