Skip to content

floor

Round down

floor x    floor[x]

Returns the greatest integer less than or equal to numeric x.

q)floor -2.1 0 2.1
-3 0 2

floor is a multithreaded primitive.

Implicit iteration

floor is an atomic function.

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: 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 . . . s . . . .

Prior to V3.0

Prior to V3.0, floor

q)floor 2 - 10 xexp -12 -13
1 2

q)floor 2009.10.03T13:08:00.222  /type error since V3.0
2009.10.03
q)"d"$2009.10.03T13:08:00.222
2009.10.03

Domain and range

The following shows the resulting output (range) type given the input (domain) type of x. For the character codes of the datatypes, refer to Datatypes.

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

Mathematics