Number Sign
Negative, zero, or positive — tell in one node
- sign
- sign_text
Sometimes you don't need the number, just the direction. Number Sign looks at a value and tells you which of three buckets it falls into: negative, zero, or positive. That's it - and it's exactly the kind of tiny building block that makes conditional logic readable when you'd otherwise be comparing values against zero and chasing edge cases.
It's part of DebugPadawan's ComfyUI Essentials, a pure-Python utility pack. This node is a three-way if in a box.
How it works
One required input:
value- the number to classify (FLOAT, default 0)
Two outputs:
sign- an INT:-1for negative,0for zero,1for positivesign_text- the same answer as a STRING:"negative","zero", or"positive"
The implementation is exactly that: value > 0 gives (1, "positive"), value < 0 gives (-1, "negative"), and anything else (including exactly 0.0) gives (0, "zero"). No tolerance, no rounding - strict comparison.
When it earns its place
- Direction checks. If a computed delta between two values went negative, you know the trend direction without caring about the magnitude. Feed
signinto aNumber Compareor aLogic Gateand branch on the direction. - Sanity checks. Before a node that chokes on negatives, check the sign and route to a
Number Absor a clamp if it's-1. - Readable debugging.
sign_textgives you "positive" in a log instead of a bare number - small thing, but it makesDebug Printoutput much friendlier when you're auditing a complex graph.
Because the output is an INT (-1/0/1), you can also use it directly as a multiplier - flip a direction, toggle a sign - without a comparison step. That's a neat trick for animation or math pipelines: multiply by sign to apply or reverse a value.
Installing it
Same story as every node in the pack - one install, all nodes. ComfyUI Manager, searching for "DebugPadawans-ComfyUI-Essentials," or:
cd ComfyUI/custom_nodes
git clone https://github.com/DebugPadawan/DebugPadawans-ComfyUI-Essentials
Then restart ComfyUI. Requirements (numpy, torch, opencv-python) are already satisfied by stock ComfyUI; no models to download. Beware the name collision when searching: this is DebugPadawan's ComfyUI Essentials, not cubiq's "ComfyUI Essentials," which is a different pack now in maintenance mode.
Gotchas
- Zero is exact.
-0.0and0.0both classify as zero. A value like1e-12counts as positive, not zero - there's no epsilon here, unlike the pack'sNumber Comparewhich builds tolerance into its equal check. - The INT output is small but if you expected a boolean you'll need to adapt -
signof-1is truthy in Python, so branch carefully. - It's a small, quiet pack; there's no big community writeup for this node, because there's not much to write. That's the point.
Inputs (1)
| Name | Type | Default | Description |
|---|---|---|---|
| value | FLOAT | 0.00 | — |
Outputs (2)
| Name | Type | Description |
|---|---|---|
| sign | INT | — |
| sign_text | STRING | — |