Divide
Divide, but it respects whether you gave it an int or a float
- x
- result
Divide in ComfyUI is the node you keep reaching for at 2am when you're computing denoise values by hand. Stock ComfyUI has INT and FLOAT math nodes, but they're picky about types - feed a float into an int node and you get a widget that refuses to cooperate. WtlDivide is the WtlNodes answer: one node that quietly takes whatever you plug in and matches its behavior to it.
The trick is the dual widget. You get an x input that accepts either INT or FLOAT, plus two sliders - int_value and float_value, both defaulting to 1. Whichever type you connect to x, the frontend shows the matching slider and hides the other. Under the hood the node just checks isinstance(x, int) and picks the right one. No casting surprises, no "wrong type" wall of errors.
The output is result, and it's type-aware too. If both inputs are ints and the division comes out exact - say 10 / 2 - you get an int back, which matters when the next node is another INT socket that will reject a float. If there's a remainder, or either side is a float, you get a float. That's a small thing until it isn't.
Two honest warnings. First, this node raises a hard ValueError on division by zero - it will not quietly hand you infinity. The error message is even prefixed [WtlDivide] so it's easy to spot in the console. It's the correct behavior, but if you're building a workflow where the divisor can legitimately hit zero, guard it upstream. Second, the node lives in the WtlNodes pack, so you won't have it until you install the pack.
Install via ComfyUI Manager - search "WtlNodes" - or the old-fashioned way:
cd ComfyUI/custom_nodes
git clone https://github.com/Scorpiosis0/ComfyUI-WtlNodes.git
then restart ComfyUI. The pack's only Python deps are numpy, scipy, and pillow, and there are no model files to download, so it's about as painless as a custom node install gets. No API keys, no GPU requirements, nothing to babysit.
Realistically this is a 30-second tool in a pack whose showpieces are elsewhere. But when you need to divide a sigma by something and keep the result compatible with whatever it feeds into, it beats juggling stock math nodes and hoping the types line up.
Inputs (3)
| Name | Type | Default | Description |
|---|---|---|---|
| x | INT,FLOAT | — | |
| int_value | INT | 1-2147483648–2147483647 | — |
| float_value | FLOAT | 1.00-1000000000–1000000000 | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| result | INT,FLOAT | — |