ComfyUI Node

Floor

Round a number down to a clean integer

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

Floor takes a number and rounds it down to the nearest integer. 3.9 becomes 3. 3.1 becomes 3. Even 3.0 becomes 3. It's the "always go down" rounding mode, and it's one of three rounding utilities in this pack - Floor, Ceil (round up), and Round (round to nearest) - which between them cover every "I need a whole number out of this float" situation.

Where you need it: resolution and batch math are full of places where a computation produces fractional results and the next node wants an integer. A size formula that spits out 1023.7 pixels, a step count that computes to 12.4, a batch size that needs to be a clean whole number - Floor guarantees you never hand a float where an int is required. There's also a symmetry argument for it: image dimensions in particular are unforgiving about fractional values, and flooring is the safe direction because you never ask for more pixels than you computed.

How it works

The mechanism is Python's math.floor() in a node. The input value accepts ints or floats via the type template, and the output result is always an INT. That output type is the whole point - it's a hard guarantee that whatever comes out is a whole number, which makes Floor a natural bridge between float-producing math nodes and int-only consumers.

A note on behavior that surprises people: floor goes toward negative infinity, not toward zero. floor(-2.3) is -3, not -2. For positive numbers - the usual case in image work - it's simply "round down," but if you ever floor a negative value and the result looks one off, that's the reason. If you want "toward zero," that's truncation, which this node doesn't do.

The inputs that matter

  • value - the number to round down.

Output is result, an INT. Wire it directly into any int input - resolutions, counts, dimensions - without a separate conversion step.

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 show up.

Common issues

  • Negative inputs round "the wrong way" - that's floor semantics (floor(-2.3) is -3), not a bug. Keep image and count math positive and it behaves as you expect.
  • Result still shows a decimal - check the output type; Floor's output is INT by design, so if you see a float downstream, something re-introduced it after this node.

Floor, Ceil, and Round are three sides of the same coin - pick Floor when you want to be conservative (never round up past what you computed), and reach for it any time a float lands where a pixel count belongs.

Categoryutils/math

Inputs (1)

NameTypeDefaultDescription
valueCOMFY_MATCHTYPE_V3

Outputs (1)

NameTypeDescription
resultINT