# `floor`

_Round down_
```syntax
floor x    floor[x]
```

Returns the greatest integer less than or equal to numeric `x`.
```q
q)floor -2.1 0 2.1
-3 0 2
q)floor 1.5 -1.5e
1 -2
```

The result of `floor` on a real or float is a long. Infinities, and values outside the range of a long, return a null.
```q
q)floor 2.5 0n 0w -0w
2 0N 0N 0N
q)floor 1e20
0N
```

Short and int arguments are returned unchanged.
For chars and symbols, `floor` is the same as [`lower`](lower.md).
```q
q)floor "aB"
"ab"
q)floor `Ab
`ab
```

`floor` signals an error on a datetime. To get its date, use `"d"$`.
```q
q)floor 2009.10.03T13:08:00.222
'use "d"$
  [0]  floor 2009.10.03T13:08:00.222
       ^
q)"d"$2009.10.03T13:08:00.222
2009.10.03
```

`floor` is a [multithreaded primitive](mt-primitives.md).

## Implicit iteration

`floor` is an [atomic function](atomic.md).
```q
q)floor(1.2;3.4 5.6)
1
3 5

q)floor`a`b!(1.2;3.4 5.6)
a| 1
b| 3 5

q)floor([]a:1.2 3.4;b:5.6 7.8)
a b
---
1 5
3 7
```

## Domain and range
```txt
domain: b g x h i j e f c s p m d z n u v t
range:  . . . h i j j j c s . . . . . . . .
```

Range: `hijcs`

----

[`ceiling`](ceiling.md),
[`lower`](lower.md)


[Mathematics](math.md)
