Ceil
Round a decimal up to a whole number
- INT
Ceil rounds a decimal up to the nearest whole number and outputs an INT: 1.01 becomes 2, 7.4 becomes 8. It's the converter you reach for at the end of a Derfuu math chain when the result must be an integer and you want to make sure you never round short of a target. Its mirror image is Floor, which rounds down; the two exist so you can choose the safe direction for each situation.
How it works
It takes a float and returns the smallest integer that isn't less than it. For negatives, "up" means toward zero - -1.7 ceils to -1 - which is the opposite of what Floor does and occasionally trips people up in offset math.
The inputs and outputs that matter
- Value (FLOAT, default 1) - the number to round up. Feed it from a math node; the default of 1 ceils to 1.
- Output: INT - the rounded-up whole number, wired into an input that needs an integer (width, height, offset, steps).
Where it fits
The math nodes in this pack (Multiply, Divide, Power, Square root) all emit floats, so a float→int conversion is nearly always the last step before a dimension is usable. Pick Ceil when coming up short would break something - you need at least this many pixels, at least this many steps to cover a range, a size that fully contains a region rather than clipping it. When overshooting is the risk instead, use Floor; when you just want a clean integer with no directional preference, Derfuu's Integer node converts too.
How to install it
ComfyUI Manager: search Derfuu_ComfyUI_ModdedNodes, install, restart. Manual:
cd ComfyUI/custom_nodes
git clone https://github.com/Derfuu/Derfuu_ComfyUI_ModdedNodes
then restart. No dependencies, no models - plain Python.
Common issues & troubleshooting
Negatives round "toward zero." Ceil(-1.7) is -1, not -2. If you're ceiling an offset that can go negative and it lands one higher than you expected, that's the reason - Floor or an Absolute value first may be what you want.
You overshot the target by a pixel. Rounding up always bumps a non-whole value to the next integer, so a size can end up one pixel over. Usually harmless, but if an exact size matters, do the arithmetic to hit it precisely.
Dimension still not a multiple of 8. Ceil gives you an integer, not a multiple of 8 or 64. If the model requires that, handle the multiple-of-8 math separately.
Node red after a pack update. Derfuu has removed deprecated nodes on updates rather than keeping them around, so old graphs can reference names that vanished - reconnect a fresh copy. A ModuleNotFoundError about Derfuu_ComfyUI_ModdedNodes_legacy means a duplicated folder; keep one named Derfuu_ComfyUI_ModdedNodes.
Inputs (1)
| Name | Type | Default | Description |
|---|---|---|---|
| Value | FLOAT | 1.00 | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| INT | INT | — |