Professional Documents
Culture Documents
The floor and ceiling functions give us the nearest integer up or down.
Floor
2
0
1
2
3
Ceiling
1
0
2
3
3
Symbols
The symbols for floor and ceiling are like the square brackets
missing:
Definitions
How do we give this a formal definition?
The greatest integer that is less than (or equal to) 2.31 is 2
Which leads to our definition:
Floor Function: the greatest integer that is less than or equal to x
Likewise for Ceiling:
Ceiling Function: the least integer that is greater than or equal to x
As A Graph
The Floor Function is this curious "step" function (like an infinite staircase):
Others say int(3.65) = 3 (the rule is: neighbouring integer closest to zero, or "just
throw away the .65")
frac(x) = x floor(x)
HOWEVER: many calculators and computer programs use frac(x) = x int(x), and so their
result depends on how they calculate int(x):