LogicUtil_Divide
Divide two values and get a float — and yes, it refuses to divide by zero
- input1
- input2
- FLOAT
Division is where ComfyUI's math gets honest. LogicUtil_Divide takes input1 and divides it by input2, returning a FLOAT. The twist is the input types: both are wildcard *, so they accept anything, and the node does true Python division - which means 7 / 2 gives you 3.5, not 3. No integer truncation, no rounding, always a float on the output. That's deliberate, and it's the difference between this and a node that hands you a clean INT.
How it works
It's input1 / input2 under the hood, with one guard: if input2 is 0, the node raises a ZeroDivisionError instead of silently producing infinity or crashing with a confusing message elsewhere. That's a genuinely good behavior - a divide-by-zero buried in a workflow will fail here, in the node that caused it, with a readable console error, instead of poisoning a value that flows into five other nodes before something breaks.
Because the inputs are *-typed, it'll also accept strings if you're careless - and "10" / 2 is a TypeError, so you'll get a traceback rather than a helpful value. Feed it numbers.
Where it fits
- Computing per-frame or per-batch values: total frames divided by batch size, total cost divided by number of runs.
- Normalizing - dividing a score or count by another computed value.
- As the numerator half of a ceil-division count (
LogicUtil_DivideintoLogicUtil_Ceil, both in this pack).
It's part of the pack's LogicUtil set - the LogicUtil_ prefix marks it as a port of aria1th's ComfyUI-LogicUtils - where it sits alongside Add, Multiply, and the Min/Max nodes as the arithmetic basics you'd otherwise have to source from a bigger math pack.
Install
Ships in ComfyUI-JDCN. 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
Only pack dependency is piexif (plus psutil, already in ComfyUI). No models to download.
Gotchas
- Always a float, never an int.
4 / 2returns2.0, not2. If a downstream node insists on INT, run the result throughLogicUtil_Convert to Int- but remember that convert truncates, so floor/ceil the division if you want mathematically correct counts. - Divide by zero is a hard failure. It's the right behavior, but it means a workflow where the divisor can legitimately be 0 needs a guard upstream - check the value and branch before it reaches this node.
- Negative divisors are fine - sign handling is normal math, no surprises.
Clean, honest, and it fails where you can see it. For arithmetic inside a graph, that's most of what you want.
Inputs (2)
| Name | Type | Default | Description |
|---|---|---|---|
| input1 | * | — | |
| input2 | * | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| FLOAT | FLOAT | — |