Floor and Ceiling Function
Floor and Ceiling Function
Floor and Ceiling Function
Floor function
Ceiling function
In mathematics and computer science, the floor and ceiling functions map a real number to the
largest previous or the smallest followinginteger, respectively. More precisely, floor(x) =
is the
[1]
Contents
[hide]
1 Notation
o
1.1 Examples
1.2 Typesetting
2.1 Equivalences
2.3 Quotients
2.5 Continuity
3 Applications
o
3.3 Rounding
3.4 Truncation
4 Computer implementations
4.1 Spreadsheet software
5 See also
6 Notes
7 References
8 External links
Notation[edit]
Carl Friedrich Gauss introduced the square bracket notation
proof of quadratic reciprocity (1808).[2] This remained the standard[3] in mathematics until Kenneth E.
Iverson introduced the names "floor" and "ceiling" and the corresponding notations
his 1962 book A Programming Language.
[4][5]
and
in
.[8]
or just using
For all x,
Examples[edit]
Sample value x
Floor
Ceiling
Fractional part
12/5 = 2.4
2/5 = 0.4
2.9
0.9
2.7
0.3
Typesetting[edit]
The floor and ceiling function are usually typeset with left and right square brackets where
the upper (for floor function) or lower (for ceiling function) horizontal bars are missing, and,
e.g., in the LaTeX typesetting system these symbols can be specified with the \lfloor,
\rfloor, \lceil and \rceil commands in math mode. HTML 4.0 uses the same
names:⌊, ⌋, ⌈, and ⌉. Unicode contains codepoints for these symbols
at U+2308 U+230B : x, x.
is the
Since there is exactly one integer in a half-open interval of length one, for any
real x there are unique integers m and n satisfying
Then
and
and ceiling.
Equivalences[edit]
These formulas can be used to simplify expressions involving floors and
ceilings.[12]
These formulas show how adding integers to the arguments affect the
functions:
and:
Quotients[edit
]
If m and n are
integers and n
0,
If n is
positive[13]
If m i
s
positi
ve[14]
Fo
r
m
=
2
th
es
e
im
ply
More
genera
lly,[15] fo
r
positiv
e m (S
ee Her
mite's
identity
)
The following
can be used to
convert floors
to ceilings and
vice-versa
(m positive)[16]
If m and n are p
symmetrical in m
this implies that
More generally,
positive,
This is sometime
a reciprocity law
Nested divis
arbitrary real nu
Continuity[ed
and
functions, with d
integers.
al
integers, and
of x for fixed y is
of y.
is upper se
and
are lo
continuous. x m
semicontinuous
semi-continuous
Series expan
Since none of th
have a power se
have uniformly c
series expansion
in particular {x} =
At points of disc
to a value that is
part functions: fo
Fourier series gi
to x mod y = 0. A
converges to the
Application