Nodes/was-node-suite-comfyui/Number Operation
ComfyUI Node Runs on cloud

Number Operation

Do math on numbers inside your graph

By WASasquatch·Created 3 years ago·Updated about a year ago· 1,812
Number Operation

      Number Operation is a calculator node. Two numbers go in, you pick an operation, one number comes out. Add, subtract, multiply, divide and the usual arithmetic friends - it's the node you drop in when a value somewhere in your graph needs to be computed rather than typed.

      Why it exists

      ComfyUI graphs are full of numbers that ought to relate to each other but don't, until you wire them up. You want your upscale target to be exactly 1.5× the source width. You want steps and denoise to move together. You want to take an image's width, halve it, and feed that somewhere. Hard-coding those means editing by hand every time an input changes; a math node makes the relationship live. Change the source, and everything derived from it updates on the next run.

      It's rarely the star of a workflow. It's the connective tissue that turns a pile of fixed values into something that adapts - and WAS ships a whole logic/number toolkit around it (Number Counter, Number Input Condition, Number to Int/Float/Seed, the boolean logic nodes) precisely so you can build small computed behaviors without leaving the graph.

      How it works

      You feed it two number inputs (call them A and B), choose the operation, and it returns the result as a number. That output plugs into anything that takes a number - a seed, a width/height, another math node, a switch's boolean via a comparison. Chain a few together and you can express genuinely useful logic: derive one dimension from another, clamp a value into a range, step something proportionally.

      Things that trip people up

      • Divide by zero. If B can ever land on zero, division will error or produce something nonsensical. Guard it, or make sure your inputs can't reach zero.
      • Int vs float. Some downstream inputs want a whole number (dimensions, steps), others are happy with decimals (denoise, cfg). If a value gets rejected, convert it - WAS has Number to Int / Number to Float for exactly this. Integer division and rounding can also surprise you, so check whether you're getting 3 or 3.5 before wiring it into a size.
      • It's two operands. For a longer expression, chain multiple Number Operation nodes rather than expecting one to parse a formula.

      Installing it

      Comes with WAS Node Suite. Install the pack via ComfyUI Manager (search was-node-suite-comfyui, install, restart) or clone it:

      cd ComfyUI/custom_nodes
      git clone https://github.com/WASasquatch/was-node-suite-comfyui
      

      install requirements.txt, restart. No models - it's arithmetic.

      Troubleshooting

      The node can't really break; the pack can. WAS Node Suite has been unmaintained since December 2023, and the recurring failure is the whole suite throwing "Import Failed" after a ComfyUI update, from a pinned dependency (usually opencv) clashing with the new version. Reinstall requirements.txt into the correct venv - activate it, or use install.bat - and the number nodes come back with the rest.

      Categoryx

      Inputs (0)

      No inputs

      Outputs (0)

      No outputs