ComfyUI Node

ceil

Round up, every time, to the nearest whole number

By StableLlama·Created about a year ago·Updated 4 days ago· 48
ceil
  • value
  • INT

The "always round up" button

Ceiling - ceil - is the rounding mode that never rounds down: the smallest integer greater than or equal to your number. ceil(3.1) → 4, ceil(3.0) → 3 (already whole, stays put), ceil(-3.1)-3, because "up" means toward positive infinity, not toward zero. If you're computing a batch count, a number of tiles, or any quantity that must be a whole number and can't afford to be short, this is the node.

It's the mirror image of the floor concept - the pack's math category has the rounding family, and ceil is the one you pick when "not enough" is worse than "a bit too many."

How it works

The node runs math.ceil(float(value)) and - the detail people notice - returns an INT, not a FLOAT. Unlike the pack's trig and abs nodes which output floats, rounding nodes hand back integers because that's the point: a whole number out. That means you can wire the result straight into any INT input (seeds, steps, counts) with no cast step.

The value input is a text field taking a plain number - float()-parsed, so 3.7 or 4 both work, but no expressions. Feed it a computed result from another node if the number isn't static.

One trap worth flagging for negative numbers: ceil(-1.5) is -1, not -2. "Round up" in math-land means "toward +∞," which feels backwards if you're used to "round toward zero" intuition. If you actually want to round negative numbers toward zero, that's a different operation (and this pack's int/float sections have the pieces to build it).

Inputs and outputs

  • value (FLOAT or INT, default 0) - the number to round up.

Output is a single INT: the smallest whole number ≥ the input.

Installing it

Ships in Basic data handling by StableLlama, the r/StableDiffusion regular whose model writeups (his Flux Klein 9B conclusions thread especially) are better known than his code. The pack is dependency-free by design - zero runtime requirements, no models, no API keys.

Install via ComfyUI Manager (search "Basic data handling") or:

cd ComfyUI/custom_nodes
git clone https://github.com/StableLlama/ComfyUI-basic_data_handling

Restart ComfyUI; it's under Basic/maths.

Troubleshooting

The main confusion is negative numbers rounding "up" to a larger value - ceil(-1.1)-1. If you expected -2, you want truncation instead. Other than that there's no failure mode worth losing sleep over: the input always has a ceiling, and the output is always a valid int. Just remember the result is INT-typed, which is a feature unless you specifically needed a float.

CategoryBasic/maths

Inputs (1)

NameTypeDefaultDescription
valueFLOAT,INT0

Outputs (1)

NameTypeDescription
INTINT