Skip to content

floor

floor

🔢 Number

Round down to the nearest integer (toward negative infinity)

floor(number) → number
number

The largest integer less than or equal to the input; null if input is null

The floor function rounds the input number down to the nearest integer (floor function).

  • If number is null, returns null
  • floor(3.0) returns 3 (already an integer)
  • floor(3.9) returns 3
  • floor(-2.1) returns -3 (rounds toward negative infinity, not toward zero)
  • floor(0) returns 0
| eval hours = floor(duration_seconds / 3600)

Calculates how many complete hours are in a duration.

| eval request_batch = floor(request_id / 100)

Groups requests into batches of 100.

| stats sum(floor(cost))

Calculates total cost with each item rounded down.

  • eval — to create or transform numeric fields