Katana VentraIP

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).[1]

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, integer part, or entier of x, often denoted [x] (as well as a variety of other notations).[2] 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.

U+2308 LEFT CEILING (⌈, ⌈)

U+2309 RIGHT CEILING (⌉, ⌉)

U+230A LEFT FLOOR (⌊, ⌊)

U+230B RIGHT FLOOR (⌋, ⌋)

The integral part or integer part of a number (partie entière in the original) was first defined in 1798 by Adrien-Marie Legendre in his proof of the Legendre's formula.


Carl Friedrich Gauss introduced the square bracket notation [x] in his third proof of quadratic reciprocity (1808).[3] This remained the standard[4] in mathematics until Kenneth E. Iverson introduced, in his 1962 book A Programming Language, the names "floor" and "ceiling" and the corresponding notations x and x.[5][6] (Iverson used square brackets for a different purpose, the Iverson bracket notation.) Both notations are now used in mathematics, although Iverson's notation will be followed in this article.


In some sources, boldface or double brackets x are used for floor, and reversed brackets x or ]x[ for ceiling.[7][8]


The fractional part is the sawtooth function, denoted by {x} for real x and defined by the formula


For all x,


These characters are provided in Unicode:


In the LaTeX typesetting system, these symbols can be specified with the \lceil, \rceil, \lfloor, and \rfloor commands in math mode, and extended in size using \left\lceil, \right\rceil, \left\lfloor, and \right\rfloor as needed.


Some authors define [x] as the round-toward-zero function, so [2.4] = 2 and [−2.4] = −2, and call it the "integer part".

Applications[edit]

Mod operator[edit]

For an integer x and a positive integer y, the modulo operation, denoted by x mod y, gives the value of the remainder when x is divided by y. This definition can be extended to real x and y, y ≠ 0, by the formula

Bracket (mathematics)

Integer-valued function

Step function

Modulo operation

J.W.S. Cassels (1957), An introduction to Diophantine approximation, Cambridge Tracts in Mathematics and Mathematical Physics, vol. 45,

Cambridge University Press

Crandall, Richard; Pomerance, Carl (2001), , New York: Springer, ISBN 0-387-94777-9

Prime Numbers: A Computational Perspective

Graham, Ronald L.; Knuth, Donald E.; Patashnik, Oren (1994), Concrete Mathematics, Reading Ma.: Addison-Wesley,  0-201-55802-5

ISBN

Hardy, G. H.; Wright, E. M. (1980), , Oxford: Oxford University Press, ISBN 978-0-19-853171-5

An Introduction to the Theory of Numbers (Fifth edition)

Nicholas J. Higham, Handbook of writing for the mathematical sciences, SIAM.  0-89871-420-6, p. 25

ISBN

/IEC. ISO/IEC 9899::1999(E): Programming languages — C (2nd ed), 1999; Section 6.3.1.4, p. 43.

ISO

Iverson, Kenneth E. (1962), A Programming Language, Wiley

Lemmermeyer, Franz (2000), Reciprocity Laws: from Euler to Eisenstein, Berlin: , ISBN 3-540-66957-4

Springer

Ramanujan, Srinivasa (2000), Collected Papers, Providence RI: AMS / Chelsea,  978-0-8218-2076-6

ISBN

Ribenboim, Paulo (1996), The New Book of Prime Number Records, New York: Springer,  0-387-94457-5

ISBN

Michael Sullivan. Precalculus, 8th edition, p. 86

Titchmarsh, Edward Charles; Heath-Brown, David Rodney ("Roger") (1986), The Theory of the Riemann Zeta-function (2nd ed.), Oxford: Oxford U. P.,  0-19-853369-1

ISBN

, Encyclopedia of Mathematics, EMS Press, 2001 [1994]

"Floor function"

Štefan Porubský, , Interactive Information Portal for Algorithmic Mathematics, Institute of Computer Science of the Czech Academy of Sciences, Prague, Czech Republic, retrieved 24 October 2008

"Integer rounding functions"

"Floor Function". MathWorld.

Weisstein, Eric W.

"Ceiling Function". MathWorld.

Weisstein, Eric W.