Jump to content

Floor and ceiling functions

From Wikipedia, the free encyclopedia

This is an old revision of this page, as edited by FvdP (talk | contribs) at 00:07, 25 January 2003 (fixed markup. ⌉ etc are TeX tags, not HTML tags, apparently). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.

In mathematics, the floor function is the function defined as follows: for a real number x, floor(x) is the largest integer less than or equal to x. For example, floor(2.3) = 2, floor(-2) = -2 and floor(-2.3) = -3. The floor function is also denoted by [x] or ⌊x⌋.

We always have

floor(x) ≤ x < floor(x) + 1

with equality on the left if and only if x is an integer. For any integer k and any real number x, we have

floor(k+x) = k + floor(x).

The ordinary rounding of the number x to the nearest integer can be expressed as floor(x + 0.5).

The floor function is not continuous, but it is upper semi-continuous.

A closely related mathematical function is the ceiling function, which is defined as follows: for any given real number x, ceiling(x) is the smallest integer no less than x. For example, ceiling(2.3) = 3, ceiling(2) = 2 and ceiling(-2.3) = -2. The ceiling function is also denoted by . It is easy to show the following: and the following:

For any integer n, we also have the following equality:

.

If m and n are coprime integers, then

1≤in-1 floor(im/n) = (m-1)(n-1)/2.