LogicUtil_Negate Value
Flip the sign on any number, mid-graph
- input1
- *
You've got a strength slider and the workflow needs the negative of it. Or you're feeding a denoise value into two different places and one of them expects the inverted sign. That's the entire job of LogicUtil_Negate Value: one input in, the additive inverse out. No flags, no modes, no settings - x goes in, -x comes out.
How it works
In the source it's a single line: return (-input1,). The input input1 is typed as * (accepts anything) with a default of 0, and the output is the same wildcard type. Because the math happens on whatever Python's unary minus can handle, this works on ints and floats - wire it into a numeric field and you're done.
Where people get burned: it is not a boolean flip. A common rookie move is reaching for this thinking it "negates" a True/False like an inverter - it doesn't. Negating True gives you -1, not False. If you want the logic gate, grab LogicUtil_Invert Basic instead; those two get confused constantly because they sit next to each other in the LogicUtil menu and both say "negate/invert" somewhere in the name.
The other trap is type. -input1 will happily throw a TypeError if you feed it a string or a tensor. The * input type is the ComfyUI "anything" wildcard, which means the graph won't stop you from wiring text into it - it just explodes at queue time. If you need to negate a string's meaning, you want a different tool entirely.
A genuinely useful pattern: pair it with LogicUtil_Multiply to build a configurable sign flipper, or hang it off a Max/Min pair to flip which side of a threshold a value gets clamped toward. Since the whole LogicUtil family is a port of aria1th's ComfyUI-LogicUtils shipped inside the JDCN pack, the display name LogicUtil_Negate Value in the graph is the original's class name with a prefix.
Install
Install is the standard JDCN dance - ComfyUI Manager → "Install Custom Node" → search JDCN → install → restart, or:
cd ComfyUI/custom_nodes
git clone https://github.com/daxcay/ComfyUI-JDCN
cd ComfyUI-JDCN && pip install -r requirements.txt
Just piexif on the requirements list, no model downloads. The one thing worth remembering after install is that the pack's README only documents the file/latent batch nodes, so this node's behavior lives in the original LogicUtils repo - which is exactly where the "is it a boolean flip or a sign flip" confusion starts.
Inputs (1)
| Name | Type | Default | Description |
|---|---|---|---|
| input1 | * | 0 | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| * | * | — |