- value
- MATCHTYPE
Absolute takes a number and returns its distance from zero - minus signs stripped, magnitude kept. -5 becomes 5, 5 stays 5, -0.25 becomes 0.25. It's a one-line node in a pack full of one-line nodes, but it answers a real problem: computed values in workflows go negative all the time, and negative is frequently meaningless.
Where you reach for it: any time a calculation can produce a negative number but only the magnitude matters. Differences and deltas are the classic case - "how far off are these two values?" - where the sign is noise and the size is the signal. It's also the cleanup step before feeding a value somewhere that can't tolerate negatives, like a size, a strength, or a count. If a divisor or a dimension ever comes out negative, an Abs on the wire turns a downstream crash into a working value.
How it works
The mechanism is Python's abs() in a node. The input value accepts ints or floats via the type template, and the output type follows the input - abs on an int stays an int, abs on a float stays a float. That type-preserving behavior is nice: you don't get surprise type changes from the cleanup step.
There's no state, no clamping, nothing else. Absolute value doesn't "fix" a negative in any clever sense - it just reports its magnitude. If you need to know whether a value went negative rather than ignoring that it did, that's a job for a Compare node, not Abs.
The inputs that matter
value- the number to take the absolute value of.
Output is the magnitude, a MATCHTYPE number matching the input type.
Install
This node ships in the ComfyUI-LogicMath pack. Install via ComfyUI Manager (search "ComfyUI-LogicMath", Install, restart) or:
cd ComfyUI/custom_nodes
git clone https://github.com/silveroxides/ComfyUI-LogicMath
No pip requirements, no model downloads. The pack uses ComfyUI's newer extension API, so if the node doesn't show up after a restart, update ComfyUI first.
Common issues
- "It didn't fix my negative problem" - Abs only strips the sign. If a negative is wrong, not just unwanted, find the calculation that produced it; Abs will happily hide the bug.
- Surprised by a type change - there shouldn't be one; abs preserves the input type by design.
Absolute is a small, forgettable node that earns its place the first time a workflow hands you a magnitude from a difference. Wire it in when "how much, not which direction" is the question.
Inputs (1)
| Name | Type | Default | Description |
|---|---|---|---|
| value | COMFY_MATCHTYPE_V3 | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| MATCHTYPE | COMFY_MATCHTYPE_V3 | — |