Nodes/WWAA-CustomNodes/🪠️ WWAA Basic Math
ComfyUI Node

🪠️ WWAA Basic Math

Two numbers in, int and float results out

By hgabha·Created 2 years ago·Updated 6 months ago· 38
🪠️ WWAA Basic Math
  • a
  • b
  • result_int
  • result_float
operationa+b

WWAA Basic Math is ComfyUI's bare-bones arithmetic node from the WWAA-CustomNodes pack: two numeric inputs, one operation, two outputs. You've almost certainly seen (or wanted) this exact node a hundred times - ComfyUI's core math options are spread across several primitives, and this one packages the common cases into a single dropdown.

It's from the WeirdWonderfulAI.Art team. Nothing exotic here, and that's the appeal: when you need to multiply a seed by two or compute a step for a counter, it's one node with one dropdown instead of hunting for the right primitive.

How it works

a and b accept either INT or FLOAT (the input type is literally "INT,FLOAT"), and the operation dropdown chooses between a+b, a-b, b-a, a*b, a/b, b/a, a%b, and a**b. The node computes the result and hands it back twice: result_int (the value truncated to an integer) and result_float (the full float). So one node covers the "I need this as a whole number here and a decimal there" case without conversion nodes in between.

The implementation has some defensive handling worth knowing: division or modulo by zero returns 0.0 instead of crashing, and an out-of-range power operation (a**b) also degrades to 0.0 rather than throwing. That's forgiving, but it's also silent - a zero result might mean a real zero or a swallowed error, so keep an eye on it if your math suddenly goes flat.

Inputs and outputs

  • a, b - INT or FLOAT values.
  • operation - pick from the 8-option dropdown.

Outputs: result_int (INT) and result_float (FLOAT).

Typical wiring: feed it the i or j outputs of the WWAA Nested Loop Counter to derive values per iteration, or use it to compute a dynamic resolution before an image dimension node.

Installing it

It ships with WWAA-CustomNodes:

cd ComfyUI/custom_nodes
git clone https://github.com/hgabha/WWAA-CustomNodes

Restart ComfyUI. Or ComfyUI Manager → search "WWAA Custom Nodes" → install → restart. It's under 🪠️ WWAA/math. No models, no declared dependencies.

Gotchas

Honestly, the "gotchas" are the two silent zero-returns above, and the truncation behavior of result_int - it's int(result), so 3.9 becomes 3, not 4. If you need proper rounding, do it elsewhere. Beyond that, it's the most straightforward node in the pack: pick an operation, get two outputs. Sometimes the simple utility is the one that keeps you from adding another dependency.

Category🪠️ WWAA/math

Inputs (3)

NameTypeDefaultDescription
aINT,FLOAT
bINT,FLOAT
operationCOMBOa+b8 options: a+b, a-b, b-a, a*b, a/b, b/a, +2

Outputs (2)

NameTypeDescription
result_intINT
result_floatFLOAT