subtract
The minus sign you keep hunting for in your graph
- FLOAT
subtract (Basic data handling: FloatSubtract) is exactly what the name says: float1 - float2, two floats in, one FLOAT out. Inputs default to 0, and the order matters - this is subtraction, not the commutative kind. Swap the wires and the sign flips, which is the only way you'll get in trouble with a node this simple.
Two floats in, one out - the workhorse case is "compute a delta." Want a denoise value relative to a base? Base − offset. Need the difference between two measured strengths to decide a branch? Feed the result into a comparison. It's the dull-but-indispensable math node that keeps your graph from forcing you to hand-compute numbers in your head and hardcode them.
When to use a formula instead
Same story as the rest of this pack's arithmetic: one subtraction is perfect here; a chain of them is a mess. If you find yourself stacking subtract nodes in series, step back and use MathFormula (Basic data handling: MathFormula) with a single expression. The dedicated nodes stay readable exactly as long as you keep them to single operations.
Both inputs are FLOAT widgets defaulting to 0, so the classic wiring is: one side from a computed node output, the other side a constant you can drag. Output is a plain FLOAT that plugs into anything numeric.
Installing it
Part of the Basic data handling pack by StableLlama. ComfyUI Manager → search "Basic data handling" → install → restart. Manual:
cd ComfyUI/custom_nodes
git clone https://github.com/StableLlama/ComfyUI-basic_data_handling
then restart. No dependencies, no requirements.txt, no model files - plain Python.
Troubleshooting
The one real trap is forgetting the output is a FLOAT even when your inputs looked like integers - 5 - 3 is 2.0, and if you wire that into an INT socket expecting 2, it'll complain or coerce in ways you didn't ask for. Cast explicitly when you need an integer. And if a result you expected to be positive comes out negative, check you haven't got the inputs backwards - with subtraction, the wires tell the story.
Inputs (2)
| Name | Type | Default | Description |
|---|---|---|---|
| float1 | FLOAT | 0.00 | — |
| float2 | FLOAT | 0.00 | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| FLOAT | FLOAT | — |