CeilDivide
The two-integer node that saves your last segment
- result
Here's a failure mode you've probably hit without knowing why: you split a 10-minute video into 3-second chunks, compute the number of chunks as total_seconds / 3, and the last chunk never renders. The reason is floating-point - 600 / 3 might be 200.00000000000003, or your loop count floors a 3.37 to 3 and silently drops the 0.37. CeilDivide exists specifically to fix this: it divides two integers and rounds up (math.ceil), so a result of 21.02 becomes 22. The author's README says it plainly: it exists so truncated remainders don't leave your last video or audio segment unsampled.
How it works
Two integer inputs, a and b, one integer output result = ⌈a/b⌉. That's the entire mechanism. Where ComfyUI's built-in integer division truncates toward zero (dropping the fractional part), this always rounds up - 21/1 → 21, but 21/2 → 11 (not 10.5 or 10). And it raises a clear error if b is 0, which is the right behavior for a division node.
The inputs and output
a- the dividend (numerator). Default 1.b- the divisor (denominator). Default 1. Range is ±999,999 for both.
Output: result (INT). Wire it into a loop count, a repeat node, or the cycle/segment-count inputs of the pack's audio nodes.
The actual use case
It's the "how many chunks do I need" math for this pack's split-into-segments philosophy. Say your audio splitter produces segments of 81 frames at 23.976 fps - that's about 3.38 seconds each. If your source is 120 seconds, 120 / 3.38 ≈ 35.5, so you need 36 segments to cover it. Floor-divide and you'll render 35, leaving the tail silent. CeilDivide gives you 36, and because it's plain integer math with no float drift, it composes predictably with total_count outputs elsewhere in the pack.
It's also handy for grid math: a 100-image batch in groups of 8 needs ⌈100/8⌉ = 13 passes, not 12. Anywhere a count must cover everything, ceiling is the safe choice.
Installing it
cd ComfyUI/custom_nodes
git clone https://github.com/dseditor/ComfyUI-ListHelper
Restart ComfyUI; find it under ListHelper/Math. No dependencies, no models. ComfyUI Manager: search "ComfyUI-ListHelper".
The honest take
It's a one-line node - you could reproduce it in any math node in two minutes. But that's exactly the point: a dedicated, predictable, no-drift integer division is the kind of tiny thing you reach for constantly once it's there, and it's more reliable than hand-rolling ceil() in a generic calculator node that's busy doing float math. If you only ever download this pack for two nodes, this and Audio Split to List are the pair that make segment-based video workflows stop silently dropping their endings.
Inputs (2)
| Name | Type | Default | Description |
|---|---|---|---|
| a | INT | 1-999999–999999 | — |
| b | INT | 1-999999–999999 | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| result | INT | — |