Floor
Round a decimal down to a whole number
- INT
Floor rounds a decimal down to the nearest whole number and hands back an INT: 1.99 becomes 1, 7.4 becomes 7. It's the converter you drop at the end of a Derfuu math chain when the result has to be an integer and you specifically want to round down - usually to stay under a limit or to guarantee a value fits. Its opposite, Ceil, rounds up; pick based on which direction is safe for your case.
How it works
It takes a float and returns the largest integer that isn't greater than it. Note that "down" for negative numbers means toward more-negative - -1.2 floors to -2, not -1 - which occasionally surprises people doing offset math.
The inputs and outputs that matter
- Value (FLOAT, default 1) - the number to round down. Feed it from a math node; the default of 1 floors to 1.
- Output: INT - the rounded-down whole number, wired into a width/height/offset/step input that rejects decimals.
Where it fits
Math nodes here (Multiply, Divide, Power, Square root) all output floats, so you almost always need a float→int step before a dimension is usable. Floor is the choice when rounding up could push you over an edge - over a VRAM-safe size, over a max the model accepts, past the bounds of a crop. If you'd rather never come up short, use Ceil; if you just want a clean integer without caring about direction, Derfuu's Integer node also converts.
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 the "wrong" way. Floor goes toward negative infinity, so -1.2 becomes -2. If you're flooring an offset that can go negative and it jumps by one more than expected, that's why - you may want Ceil, or take Absolute value first.
You're one pixel short. Flooring throws away the fractional part, so a size can land a pixel under target. If the model needs an exact or minimum size, Ceil is the safer rounding direction.
Dimension still invalid. Rounding to an integer doesn't make it divisible by 8 or 64. If your model needs that, do the multiple-of-8 math before or after - flooring alone won't guarantee it.
Node red after a pack update. Derfuu has removed deprecated nodes on updates rather than keeping them labeled, so old graphs can reference vanished names - 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 | — |