Floor and ceiling functions

In mathematics, the floor function (or greatest integer function) is the function that takes as input a real number x, and gives as output the greatest integer less than or equal to x, denoted x or floor(x). Similarly, the ceiling function maps x to the smallest integer greater than or equal to x, denoted x or ceil(x).

Floor and ceiling functions
Floor function
Ceiling function

For example, for floor: ⌊2.4⌋ = 2, 2.4⌋ = 3, and for ceiling: ⌈2.4⌉ = 3, and 2.4⌉ = 2.

Historically, the floor of x has been–and still is–called the integral part or integer part of x, often denoted [x] (as well as a variety of other notations). However, the same term, integer part, is also used for truncation towards zero, which differs from the floor function for negative numbers.

For n an integer, n⌋ = ⌈n⌉ = [n] = n.

Although floor(x+1) and ceil(x) produce graphs that appear exactly alike, they are not the same when the value of x is an exact integer. For example, when x=2.0001; ⌊2.0001+1⌋ = ⌈2.0001⌉ = 3. However, if x=2, then ⌊2+1⌋ = 3, while ⌈2⌉ = 2.

Examples
x Floor x Ceiling x Fractional part {x}
2 2 2 0
2.0001 2 3 0.0001
2.4 2 3 0.4
2.9 2 3 0.9
2.999 2 3 0.999
2.7 3 2 0.3
2 2 2 0
This article is issued from Wikipedia. The text is licensed under Creative Commons - Attribution - Sharealike. Additional terms may apply for the media files.