Subtract
Order matters, and this node is why
- operands
- MATCHTYPE
Subtraction is where a lot of "adjust this workflow" thinking lives. Denoise off by a bit? Subtract a constant. Want a value that's "this, minus a small offset"? Subtract. Want the delta between two measured numbers? Subtract. It's the unglamorous workhorse of parameter math, and MathSubtract does it with one genuinely useful twist: it's not stuck at two inputs.
The node comes from silveroxides/ComfyUI-LogicMath, the compact pack whose README is exactly one line - "Logic operators and Math nodes based on a PR that never got merged." Same author maintains the Chroma-GGUF quant pack on HuggingFace. The whole pack is V3-native: built against ComfyUI's newer extension API (comfy_api.latest), no legacy NODE_CLASS_MAPPINGS, so it needs a current ComfyUI and nothing else.
How it works
MathSubtract folds every input together left to right: operand1 - operand2 - operand3 - .... The first input is the starting value; everything after it gets subtracted from the running total. That ordering is the whole game - unlike MathMultiply, where order is irrelevant, here 10 - 3 - 2 is 5 and 3 - 10 - 2 is -9. Same numbers, completely different result.
The inputs use the pack's autogrow mechanic: you start with two operands and can add more, up to 10, so a three-way subtraction doesn't mean chaining nodes. The output is MatchType - feed ints and get an int back, feed a float anywhere and the result is a float. No silent coercion.
A practical recipe: map a sine wave's -1-to-1 range into 0-to-1 for a denoise envelope. Take sin(frame / 60), add 1, then subtract... no wait, that's addition. Subtraction's moment is when you want the inverse or the offset: 1 - strength gives you a complementary envelope, and target - current gives you the exact delta you need to nudge something.
Inputs and outputs that matter
operands- the autogrow input, 2 to 10 plugs, each an int or float. Plug order defines the math.- Output - the running difference, same type as the inputs.
That's it. No settings, no dropdowns, no modes.
Installing it
ComfyUI Manager: Manager → Install Custom Nodes → search "ComfyUI-LogicMath". Or manually:
cd ComfyUI/custom_nodes
git clone https://github.com/silveroxides/ComfyUI-LogicMath
Restart ComfyUI. No models to download, no extra pip dependencies - the only requirement is comfy_api, which ships with ComfyUI itself.
Common gotchas
- Order matters, and it's on you. The first operand is the minuend. If your result comes out negative and you were sure it shouldn't, swap the wires before you blame the node.
- V3-only. This pack registers through the new extension API only. On an older ComfyUI the node simply won't show up - update ComfyUI first, then reload.
- Type follows the inputs. An int in means an int out, but add one float and the whole result quietly becomes a float. Watch it if the downstream node is strict about INT.
Subtract is the quiet fix-it node: it won't make headlines, but the day you need to offset a CFG, un-denoise a value, or compute the gap between two numbers, it's the right tool and it's already there.
Inputs (1)
| Name | Type | Default | Description |
|---|---|---|---|
| operands | COMFY_AUTOGROW_V3 | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| MATCHTYPE | COMFY_MATCHTYPE_V3 | — |