Nodes/ComfyUI-JDCN/LogicUtil_Floor
ComfyUI Node

LogicUtil_Floor

Round down to the nearest integer — the ceil's quiet sibling

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

Floor is the math word for "round down": 3.9 becomes 3, 2.1 becomes 2, and -2.1 becomes -3 (floor moves toward negative infinity, not toward zero). LogicUtil_Floor takes input1, applies that, and returns a hard-typed INT. It's the mirror image of the pack's LogicUtil_Ceil - same shape, opposite direction - and it's the node you reach for when a calculation overshoots and you need the largest integer that doesn't exceed the value.

How it works

It wraps Python's math.floor(). The input is wildcard *, accepting INT or FLOAT, and the output is always an INT - that guarantee is the entire point, since so many ComfyUI widgets only take integers. Where it genuinely earns its keep: building a count that must never round up. Say you have 95 frames and a batch size of 8 - floor gives you 11 full batches (the 12th would be partial), and if your workflow only wants complete batches, that's the number you wanted. Feed it LogicUtil_Divide and you've built that calculation in two nodes.

Where it fits

  • Computing "how many complete groups fit" from a division, ignoring any partial remainder.
  • Dropping a computed float to an integer when a sampler or loader needs whole numbers.
  • The safety-limit pattern: floor a value that must never exceed a widget's max.

It sits in the pack's LogicUtil set (the LogicUtil_ prefix marks it as a port of aria1th's ComfyUI-LogicUtils), right next to Ceil, Round, and Abs as the rounding/absolute basics.

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

Only pack dependency is piexif (plus psutil, already in ComfyUI). No models to download.

Gotchas

  • Floor is not "drop the decimals." For negative numbers it rounds down, away from zero: floor(-2.1) is -3. If you wanted plain truncation, that's LogicUtil_Convert to Int - different behavior for negatives.
  • Integers pass through unchanged - floor(4) is 4, so wiring in an INT shows no effect. Not a bug.
  • Output is always INT - if the consumer needs a float, convert after; floor won't preserve a decimal it just removed.

It's the quieter half of the round-up/round-down pair, but when you need "the most that fits without going over," it's the only one that answers correctly.

CategoryLogicUtil

Inputs (1)

NameTypeDefaultDescription
input1*

Outputs (1)

NameTypeDescription
INTINT