Ceil
When 'At Least This Many' Is What You Actually Mean
- value
- result
UC_MathCeil rounds a number up to the nearest whole number. 2.1 becomes 3, 4.0 stays 4, and 9.999 becomes 10. It's the "at least this many" button, and in ComfyUI that exact semantic shows up all over the place once you start doing arithmetic on your own resolutions.
Why you'd reach for it
Think about tiling and chunking. If you have an image that's 1450px wide and you're slicing it into 512px tiles, you can't have 2.83 tiles - you need 3, and the third one will be partial. Ceil is the difference between a buggy 2 and a working 3. The same logic applies to batch sizes, step counts, and any quantity that has to be a whole integer. It's also the quiet hero of padding math: "whatever the content is, the canvas must be at least this size" is a ceiling, not a floor.
How it works
It's a straight math.ceil(value) call. The input accepts int or float via the pack's MatchType template, and the output is hard-typed as an INT - because the whole point of ceiling is that you get a whole number. That type guarantee is useful: you can wire the result straight into an INT-only widget like a step count or a tile count without a conversion node.
The one input that matters
value. That's it. One in, one result out.
Installing it
It lives in ComfyUI-UtilsCollection. Fastest route is ComfyUI Manager - search "ComfyUI-UtilsCollection", install, restart. Or:
cd ComfyUI/custom_nodes
git clone https://github.com/silveroxides/ComfyUI-UtilsCollection
Restart after. No model files, and the only real dependencies are opencv-python and typing-extensions.
Where people get burned
The trap is mental rather than mechanical: ceil is not the same as truncation. floor(2.9) gives 2, ceil(2.1) gives 3, but a beginner reaching for "round up" sometimes actually wants "chop off the decimal," which is a different node (UC_MathFloor) and yet another is UC_MathRound for "round to nearest." The good news is this pack ships all three as siblings, so you pick the exact semantics. Negative numbers trip people too: ceil(-2.3) is -2 (toward zero-ish, but technically toward positive infinity), not -3. It matters only in edge cases, but it's the kind of thing that produces a mysteriously-off workflow. Ceil is a two-second node - this entire paragraph is longer than its implementation - and that's fine. It's the right tool when the alternative is a hand-rolled formula that quietly breaks.
Inputs (1)
| Name | Type | Default | Description |
|---|---|---|---|
| value | COMFY_MATCHTYPE_V3 | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| result | INT | — |