ComfyUI Node

Ceil

Round a number up to a clean integer

By silveroxides·Created 7 months ago·Updated 3 months ago· 3
Ceil
  • value
  • result

Ceil takes a number and rounds it up to the nearest integer. 3.1 becomes 4. 3.9 becomes 4. Even 3.0 stays 3 (there's nothing to round). It's the mirror of Floor, and together with Round they're the pack's three answers to "I have a float and I need a whole number."

The classic use is the safety direction of rounding: when you must have at least enough of something. A computed batch size of 12.4 means you need 13 batches to cover the work. A required upscale tiles count that computes to 7.1 means you need 8 tiles. In image dimensions, ceiling is the "never undershoot" rounding mode - if your formula says a side should be 1023.1 pixels, ceiling gives you 1024 rather than cutting yourself short. If Floor is the conservative "round down," Ceil is the "make sure we have room" answer.

How it works

The mechanism is Python's math.ceil() in a node. The input value accepts ints or floats via the type template, and the output result is always an INT - a hard guarantee that whatever comes out is a whole number, ready to feed int-only consumers without a conversion step.

One behavior note, same as Floor: ceil rounds toward positive infinity, not away from zero. ceil(-2.3) is -2, which is numerically larger, and can feel backwards if you think of it as "always round up the digits." For positive values - the normal case in image and batch math - it's simply "round up."

The inputs that matter

  • value - the number to round up.

Output is result, an INT.

Install

This node ships in the ComfyUI-LogicMath pack. Install via ComfyUI Manager (search "ComfyUI-LogicMath", Install, restart) or:

cd ComfyUI/custom_nodes
git clone https://github.com/silveroxides/ComfyUI-LogicMath

No pip requirements, no model files. The pack targets ComfyUI's newer extension API, so update ComfyUI if the node doesn't appear.

Common issues

  • Negative inputs round "the wrong way" - that's ceil semantics (ceil(-2.3) is -2). Keep counts positive and it's simply round-up.
  • Result still fractional downstream - Ceil's output is INT by design; if a float shows up later, something after this node reintroduced it.

Ceil, Floor, and Round are the same family - pick Ceil when you must not undershoot, and it'll quietly keep your counts and dimensions at "enough."

Categoryutils/math

Inputs (1)

NameTypeDefaultDescription
valueCOMFY_MATCHTYPE_V3

Outputs (1)

NameTypeDescription
resultINT