LogicUtil_Max
Cap a value from above without a formula node
- input1
- input2
- *
Half of "math in ComfyUI" is just clamping things so they don't go off the rails. LogicUtil_Max takes two inputs, input1 and input2, and returns the larger one. That's the whole node - and it's exactly what you reach for when you want a value to have a floor, a lower bound that refuses to go lower.
Wait, that's backward. max(a, b) returns the larger of the two, so it enforces a floor: max(noise, 0.3) means "never go below 0.3." If you want to cap from above, that's LogicUtil_Min (min(a, b) returns the smaller, so it enforces a ceiling). Everyone flips these at least once, so say it out loud before you wire it: Max makes the value bigger-or-equal, Min makes it smaller-or-equal.
How it works
Both inputs are typed as *, the ComfyUI anything-wildcard, and the output keeps the same type. Because it's Python's built-in max(), it works on strings too - max("apple", "banana") returns "banana" by lexicographic order - but 99% of the time you'll feed it numbers. The * type means the graph won't warn you if you mix a string and a float, and Python's comparison rules will produce either an error or garbage, so keep the two inputs the same kind.
Real uses: floor a CFG or denoise value so an automated generator can't drop below what you know works; clamp a seed-derived brightness so your workflow never hands the sampler a zero; combine with LogicUtil_Min to make a proper bounded clamp (min(max(x, floor), ceiling)). It's dull, it's boring, and it's the node that keeps your animation or batch pipeline from producing the one garbage frame that ruins the whole set.
The LogicUtil family - and this node - is a port of aria1th's ComfyUI-LogicUtils shipped inside the JDCN pack, a utility grab-bag from Daxton Caylor and Jerry Davos that's best known for its file and latent batch loaders. The JDCN README won't tell you anything about this node; the docs for the family effectively live in the original LogicUtils repo.
Install
Install is the standard JDCN routine: 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
Only piexif on the requirements list, no model downloads. And when your clamped output looks wrong, check whether you reached for Max when you meant Min - that's the node's single most common mistake, and it's a two-second fix.
Inputs (2)
| Name | Type | Default | Description |
|---|---|---|---|
| input1 | * | — | |
| input2 | * | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| * | * | — |