ComfyUI Node

Number Absolute

Absolute value without the maths degree

By DebugPadawan·Created about a year ago·Updated 5 months ago· 2
Number Absolute
    • absolute
    value0.00

    You've got a number that's -5.3 and you want 5.3. That's the whole job. Number Absolute strips the sign off any float, and it's one of those nodes you don't think you need until a math-heavy workflow starts handing you negative values and you realize how often the size of something matters more than its direction.

    It ships in DebugPadawan's ComfyUI Essentials, a grab-bag utility pack from the "DebugPadawan" author. Everything in the pack is pure Python - no models, no GPU work, nothing to download besides the repo itself. This node is about as simple as the pack gets, which is saying something for a pack of simple nodes.

    How it works

    Under the hood it's one call to Python's built-in abs(). Feed it any float and you get the non-negative version of that number back. Negative in, positive out. Positive in, unchanged out. Zero in, zero out. There's no rounding, no precision loss, no state - it's a pure pass-through transformation.

    The one input is value (a FLOAT, default 0). The one output is absolute (a FLOAT).

    When you'd actually use it

    Absolute value shows up in two recurring ComfyUI situations:

    • Error and distance math. If you're comparing two values and only care how far apart they are - the difference between a target CFG and the current one, the gap between an image's aspect ratio and the one you want - you take a - b and then want the magnitude, not the sign. Absolute is that missing step.
    • Gating on "did this go negative?" Combined with a Number Compare node, you can check whether something dropped below zero and branch on it.

    It also plays nicely with the rest of the pack's Number/Math nodes: you can chain Number ClampNumber Abs, or Number RemapNumber Abs, when a downstream node doesn't tolerate negatives.

    Installing it

    You install the whole pack once and get every node in it. Either use ComfyUI Manager (search for "DebugPadawans-ComfyUI-Essentials"), or:

    cd ComfyUI/custom_nodes
    git clone https://github.com/DebugPadawan/DebugPadawans-ComfyUI-Essentials
    

    Then restart ComfyUI. The pack's requirements.txt lists numpy, torch, and opencv-python - all of which ComfyUI already ships with, so there's no extra environment setup and no model files to fetch. Don't let the word "Essentials" in the title confuse you: this is DebugPadawan's Essentials, a different, much smaller pack than cubiq's "ComfyUI Essentials," and the two don't overlap.

    Gotchas

    Honestly, there aren't many. The node can't really fail - there's no parsing, no range checks. The only thing to remember is that it outputs a FLOAT, so if a downstream node strictly wants an INT you'll need a conversion step, and that the pack is small and not widely discussed in the community, so if you ever hit a bug you're mostly on your own or filing an issue on the repo.

    If you're feeding it a value from a wildcard or text node that might be garbage, sanitize earlier - this node assumes it's already getting a number.

    CategoryDebugPadawan/Number

    Inputs (1)

    NameTypeDefaultDescription
    valueFLOAT0.00

    Outputs (1)

    NameTypeDescription
    absoluteFLOAT