ComfyUI Node

Subtract

The node that does exactly one thing well

By silveroxides·Created 2 months ago·Updated about 7 hours ago· 24
Subtract
  • operands
  • MATCHTYPE

Subtraction is the most boring thing you can do in ComfyUI, and that's exactly why this node is worth having around. UC_MathSubtract takes a list of numbers and subtracts each following one from the first, left to right: 10 − 3 − 2 gives you 5, not 9. It's part of the math cluster in silveroxides/ComfyUI-UtilsCollection, which replaced the old standalone ComfyUI-LogicMath pack - so if you've been running LogicMath for years, this is its Subtract, reskinned and still free of weird dependencies.

When would you actually wire this up? It's a parameter-plumbing node. Say you've got a batch size, a CFG offset, or a denoise value flowing from a text file or another node, and you want to nudge it. You drop a Subtract in the middle, connect your value and a constant, and feed the result into whatever's downstream. It also shines in math chains - subtract the frame offset from a frame number, subtract the "safety margin" from your max resolution, that kind of thing. Nothing about it is flashy; everything about it is convenient.

What's on the node

  • operands - an autogrow input. One socket appears, and a + adds more. The first value is the one everything gets subtracted from.
  • result - the output. It's a match-type output: plug ints in and you get an int out, plug floats in and you get a float. No type-casting headaches, which is the real reason people keep a pack like this installed.

One genuinely handy detail: the inputs are match-type too, so you can mix a float and an int and it just works rather than throwing a type error at you. That sounds small until you've spent ten minutes hunting a workflow break because one node handed an INT where a FLOAT was expected.

Installing it

It ships inside ComfyUI-UtilsCollection, not on its own. Install the pack once and you get this plus a couple hundred other nodes:

  • ComfyUI Manager: search "ComfyUI-UtilsCollection" and install.
  • Or manually:
cd ComfyUI/custom_nodes
git clone https://github.com/silveroxides/ComfyUI-UtilsCollection

Then restart ComfyUI. The pack's only Python requirements are opencv-python and typing-extensions, so there's no heavy dependency tree to babysit. If you still have the standalone ComfyUI-LogicMath pack installed, ComfyUI will offer to replace those nodes with these when you load an old workflow - take the offer and remove the old pack so you don't end up with two "Subtract" nodes in your node menu doing the same job.

Gotchas

There isn't much to trip over with a three-socket math node. The one thing to remember is the fold direction: it's first minus the rest, not "last minus everything" or anything clever. If you only ever subtract one number from one number, that distinction never comes up - but the moment you stack three operands, order matters, and the node doc is explicit about it. Left to right, always.

Otherwise: keep it in mind as the building block for bigger parameter chains. Every workflow has that one spot where a value needs shaving before it's usable, and this is the node you reach for.

Categoryutils/math

Inputs (1)

NameTypeDefaultDescription
operandsCOMFY_AUTOGROW_V3

Outputs (1)

NameTypeDescription
MATCHTYPECOMFY_MATCHTYPE_V3