Nodes/ComfyUI-JDCN/LogicUtil_Ceil
ComfyUI Node

LogicUtil_Ceil

Round a number up, and get an integer out the other side

By daxcay·Created 2 years ago·Updated about a year ago· 159
LogicUtil_Ceil
  • input1
  • INT

Ceil is the math word for "round up." 2.1 becomes 3, 5.0 stays 5, -2.3 becomes -2 (ceil moves toward positive infinity, which trips up people who think of it as "round away from zero"). LogicUtil_Ceil takes input1, applies that, and returns a clean INT - which is the whole point: a lot of ComfyUI widgets only take integers, and when you're computing a count from a division you usually need to round up, not to nearest.

How it works

The node wraps Python's math.ceil(). The input is wildcard *, so it'll happily take an INT or FLOAT from anywhere in the graph, but the output is hard-typed as INT - you always get an integer back, which is precisely why you reach for it. The classic use is ceil-division: if you have 100 frames and a batch size of 8, you need ceil(100/8) = 13 batches, not the 12 that floor would give you. Pair it with LogicUtil_Divide (same pack) and you've got a batch-count calculator in two nodes.

Where it fits

  • Computing batch or tile counts from division results, where a partial last batch still needs a run.
  • Rounding up any computed step count before it hits an INT-only widget like a sampler's steps.
  • Guaranteeing an integer when a float parameter arrives from a text or conversion node.

It's part of the LogicUtil set inside ComfyUI-JDCN (the LogicUtil_ prefix marks it as a port of the aria1th LogicUtils nodes), sitting alongside Floor, its mirror image. Floor rounds down; Ceil rounds up; pick whichever matches what your calculation needs.

Install

Ships in ComfyUI-JDCN. ComfyUI Manager → Install Custom Nodes → search "JDCN", or:

cd ComfyUI/custom_nodes
git clone https://github.com/daxcay/ComfyUI-JDCN.git
pip install -r requirements.txt

Pack dependency is just piexif (plus psutil already in ComfyUI). Nothing to download.

Gotchas

  • Ceil ≠ round away from zero. For negative numbers it rounds up toward zero: ceil(-2.3) = -2. If you wanted "further from zero," that's not this node.
  • Integers pass straight through - ceil(4) is 4, no visible change. That's correct, but it means if you wire in an INT and see no difference, the node isn't broken.
  • Output is always INT - if a downstream node needs a float, convert it after; Ceil won't preserve the decimal side because there isn't one.

Thin node, real job. When the math in your head says "wait, that's 13.4 - I need 14," this is the node that agrees with you.

CategoryLogicUtil

Inputs (1)

NameTypeDefaultDescription
input1*

Outputs (1)

NameTypeDescription
INTINT