LogicUtil_Abs
Absolute value, for when a negative number is really a distance
- input1
- *
LogicUtil_Abs takes one number and returns its absolute value: -3 becomes 3, 3 stays 3, zero stays zero. That's the entire node. It exists because ComfyUI's graph is full of values whose sign is noise - a step count difference, a motion delta, a difference between two seeds - and half the time what you actually want is the magnitude. If a workflow computes something like "frame 12 minus frame 40," that's -28, and Abs is how you get the 28 without writing a Python expression node.
How it works
The input input1 is declared with the wildcard * type, which in this pack's LogicUtil means "accept whatever you wire in." Under the hood it's just Python's built-in abs() - and Python's abs is polymorphic, so it works on integers and floats, and on complex numbers if you're feeling exotic. Output is the same type that went in (*), so no surprise conversions: abs of an INT is an INT, abs of a FLOAT is a FLOAT.
Where it fits
The honest answer: occasionally. Abs is a genuinely thin utility - you won't build workflows around it, you'll reach for it when a calculation leaves you holding a negative that's actually a size or a distance. The JDCN pack's LogicUtil category is a port of the aria1th LogicUtils node set (the LogicUtil_ prefix is the giveaway), and Abs is one of its math basics alongside Floor, Ceil, Divide and Add. They're all here so you don't need a separate logic-pack install for the two or three of them you actually use.
Install
This node ships inside the ComfyUI-JDCN pack - installing the pack gives you the whole LogicUtil set at once. ComfyUI Manager → Install Custom Nodes → search "JDCN", or:
cd ComfyUI/custom_nodes
git clone https://github.com/daxcay/ComfyUI-JDCN.git
pip install -r requirements.txt
The pack's only real dependency is piexif (plus psutil, which ComfyUI already ships). No models, nothing heavy.
Gotchas
- Input type leaks through - because the output mirrors the input type, an abs wired from an INT stays an INT, which can matter if a downstream node is strict about types.
- The wildcard
*means the node will accept nearly anything, but it also means ComfyUI won't warn you if you feed it a string.abs("4")in Python is a TypeError, and you'll get a console traceback rather than a graceful message.
It's not a node you'll think about much. It's a node you'll be glad exists at 2am when you're fixing a negative step count and don't want to drag in a math expression evaluator just for one abs().
Inputs (1)
| Name | Type | Default | Description |
|---|---|---|---|
| input1 | * | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| * | * | — |