Subtract
Subtract a value without fighting ComfyUI's type system
- x
- result
WtlSubtract takes one number, subtracts a value from it, and hands back the result with its type intact. It sounds too simple to need an article, but it exists because the stock INT/FLOAT math nodes in ComfyUI refuse to accept the "wrong" type on the input - so any workflow that computes a number mid-graph and then needs to shrink it runs into type walls. This node rips those walls down.
The input x accepts either INT or FLOAT. Alongside it are int_value and float_value, both defaulting to 0. The frontend only shows you the slider that matches whatever type is connected to x - wire in an int and you get the integer slider; wire in a float and you get the float one. It's a small UX detail and it's genuinely the thing that makes the node pleasant: you can't pick a mismatched value because the mismatched widget isn't rendered.
The output is result, typed INT,FLOAT, meaning an int minus an int gives you an int back and any float involvement gives you a float. That consistency is the actual point. When the result feeds into a node with a strict INT socket - a steps port, a seed, a batch count - you want the number to arrive as the right type, and this guarantees it.
In practice it shows up in the same workflows as WtlAdd: trimming steps for a second pass, backing a denoise value off by a fixed amount, adjusting a seed by a computed delta. If you're doing arithmetic on values that come from other nodes rather than typed by hand, this is far less brittle than wiring a bare widget into an expression.
It's part of the WtlNodes pack, so install the pack once - ComfyUI Manager (search "WtlNodes") or:
cd ComfyUI/custom_nodes
git clone https://github.com/Scorpiosis0/ComfyUI-WtlNodes.git
then restart ComfyUI. The pack needs only numpy, scipy, and pillow, and there are no model downloads. No division-by-zero traps, no hidden state - it's a leaf node that does exactly one thing. Reach for it when a stock math node starts giving you type errors, and don't think about it again.
Inputs (3)
| Name | Type | Default | Description |
|---|---|---|---|
| x | INT,FLOAT | — | |
| int_value | INT | 0-2147483648–2147483647 | — |
| float_value | FLOAT | 0.00-1000000000–1000000000 | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| result | INT,FLOAT | — |