HOME

TheInfoList



OR:

In
mathematics Mathematics is a field of study that discovers and organizes methods, Mathematical theory, theories and theorems that are developed and Mathematical proof, proved for the needs of empirical sciences and mathematics itself. There are many ar ...
, the floor function is the
function Function or functionality may refer to: Computing * Function key, a type of key on computer keyboards * Function model, a structured representation of processes in a system * Function object or functor or functionoid, a concept of object-orie ...
that takes as input a
real number In mathematics, a real number is a number that can be used to measure a continuous one- dimensional quantity such as a duration or temperature. Here, ''continuous'' means that pairs of values can have arbitrarily small differences. Every re ...
, and gives as output the greatest
integer An integer is the number zero (0), a positive natural number (1, 2, 3, ...), or the negation of a positive natural number (−1, −2, −3, ...). The negations or additive inverses of the positive natural numbers are referred to as negative in ...
less than or equal to , denoted or . Similarly, the ceiling function maps to the least integer greater than or equal to , denoted or . For example, for floor: , , and for ceiling: , and . The floor of is also called the integral part, integer part, greatest integer, or entier of , and was historically denoted (among other notations). However, the same term, ''integer part'', is also used for
truncation In mathematics and computer science, truncation is limiting the number of digits right of the decimal point. Truncation and floor function Truncation of positive real numbers can be done using the floor function. Given a number x \in \mathbb ...
towards zero, which differs from the floor function for negative numbers. For an integer , . Although and produce graphs that appear exactly alike, they are not the same when the value of is an exact integer. For example, when , . However, if , then , while .


Notation

The ''integral part'' or ''integer part'' of a number ( in the original) was first defined in 1798 by
Adrien-Marie Legendre Adrien-Marie Legendre (; ; 18 September 1752 – 9 January 1833) was a French people, French mathematician who made numerous contributions to mathematics. Well-known and important concepts such as the Legendre polynomials and Legendre transforma ...
in his proof of the
Legendre's formula In mathematics, Legendre's formula gives an expression for the exponent of the largest power of a prime ''p'' that divides the factorial ''n''!. It is named after Adrien-Marie Legendre. It is also sometimes known as de Polignac's formula, a ...
.
Carl Friedrich Gauss Johann Carl Friedrich Gauss (; ; ; 30 April 177723 February 1855) was a German mathematician, astronomer, geodesist, and physicist, who contributed to many fields in mathematics and science. He was director of the Göttingen Observatory and ...
introduced the square bracket notation in his third proof of
quadratic reciprocity In number theory, the law of quadratic reciprocity is a theorem about modular arithmetic that gives conditions for the solvability of quadratic equations modulo prime numbers. Due to its subtlety, it has many formulations, but the most standard st ...
(1808). This remained the standard in mathematics until Kenneth E. Iverson introduced, in his 1962 book ''A Programming Language'', the names "floor" and "ceiling" and the corresponding notations and . (Iverson used square brackets for a different purpose, the
Iverson bracket In mathematics, the Iverson bracket, named after Kenneth E. Iverson, is a notation that generalises the Kronecker delta, which is the Iverson bracket of the statement . It maps any statement to a function of the free variables in that statement. ...
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 are used for floor, and reversed brackets or for ceiling. The
fractional part The fractional part or decimal part of a non‐negative real number x is the excess beyond that number's integer part. The latter is defined as the largest integer not greater than , called ''floor'' of or \lfloor x\rfloor. Then, the fractional ...
is the sawtooth function, denoted by for real and defined by the formula : For all ''x'', :. These characters are provided in Unicode: * * * * In the
LaTeX Latex is an emulsion (stable dispersion) of polymer microparticles in water. Latices are found in nature, but synthetic latices are common as well. In nature, latex is found as a wikt:milky, milky fluid, which is present in 10% of all floweri ...
typesetting system, these symbols can be specified with the and commands in math mode. LaTeX has supported UTF-8 since 2018, so the Unicode characters can now be used directly. Larger versions are and .


Definition and properties

Given real numbers ''x'' and ''y'', integers ''m'' and ''n'' and the set of
integer An integer is the number zero (0), a positive natural number (1, 2, 3, ...), or the negation of a positive natural number (−1, −2, −3, ...). The negations or additive inverses of the positive natural numbers are referred to as negative in ...
s \mathbb, floor and ceiling may be defined by the equations : \lfloor x \rfloor=\max \, : \lceil x \rceil=\min \. Since there is exactly one integer in a
half-open interval In mathematics, a real interval is the set of all real numbers lying between two fixed endpoints with no "gaps". Each endpoint is either a real number or positive or negative infinity, indicating the interval extends without a bound. A real in ...
of length one, for any real number ''x'', there are unique integers ''m'' and ''n'' satisfying the equation :x-1 where \lfloor x \rfloor = m and \lceil x \rceil = n may also be taken as the definition of floor and ceiling.


Equivalences

These formulas can be used to simplify expressions involving floors and ceilings. : \begin \lfloor x \rfloor &= m \ \ &&\mbox &m &\le x < m+1,\\ \lceil x \rceil &= n &&\mbox &\ \ n -1 &< x \le n,\\ \lfloor x \rfloor &= m &&\mbox &x-1 &< m \le x,\\ \lceil x \rceil &= n &&\mbox &x &\le n < x+1. \end In the language of
order theory Order theory is a branch of mathematics that investigates the intuitive notion of order using binary relations. It provides a formal framework for describing statements such as "this is less than that" or "this precedes that". This article intr ...
, the floor function is a
residuated mapping In mathematics, the concept of a residuated mapping arises in the theory of partially ordered sets. It refines the concept of a monotone function. If ''A'', ''B'' are posets, a function ''f'': ''A'' → ''B'' is defined to be monotone if it is o ...
, that is, part of a
Galois connection In mathematics, especially in order theory, a Galois connection is a particular correspondence (typically) between two partially ordered sets (posets). Galois connections find applications in various mathematical theories. They generalize the fun ...
: it is the upper adjoint of the function that embeds the integers into the reals. : \begin x These formulas show how adding an integer to the arguments affects the functions: : \begin \lfloor x+n \rfloor &= \lfloor x \rfloor+n,\\ \lceil x+n \rceil &= \lceil x \rceil+n,\\ \ &= \. \end The above are never true if is not an integer; however, for every and , the following inequalities hold: :\begin \lfloor x \rfloor + \lfloor y \rfloor &\leq \lfloor x + y \rfloor \leq \lfloor x \rfloor + \lfloor y \rfloor + 1,\\ mu\lceil x \rceil + \lceil y \rceil -1 &\leq \lceil x + y \rceil \leq \lceil x \rceil + \lceil y \rceil. \end


Monotonicity

Both floor and ceiling functions are monotonically non-decreasing functions: : \begin x_ \le x_ &\Rightarrow \lfloor x_ \rfloor \le \lfloor x_ \rfloor, \\ x_ \le x_ &\Rightarrow \lceil x_ \rceil \le \lceil x_ \rceil. \end


Relations among the functions

It is clear from the definitions that :\lfloor x \rfloor \le \lceil x \rceil, with equality if and only if ''x'' is an integer, i.e. :\lceil x \rceil - \lfloor x \rfloor = \begin 0&\mbox x\in \mathbb\\ 1&\mbox x\not\in \mathbb \end In fact, for integers ''n'', both floor and ceiling functions are the
identity Identity may refer to: * Identity document * Identity (philosophy) * Identity (social science) * Identity (mathematics) Arts and entertainment Film and television * ''Identity'' (1987 film), an Iranian film * ''Identity'' (2003 film), an ...
: :\lfloor n \rfloor = \lceil n \rceil = n. Negating the argument switches floor and ceiling and changes the sign: : \begin \lfloor x \rfloor +\lceil -x \rceil &= 0 \\ -\lfloor x \rfloor &= \lceil -x \rceil \\ -\lceil x \rceil &= \lfloor -x \rfloor \end and: :\lfloor x \rfloor + \lfloor -x \rfloor = \begin 0&\text x\in \mathbb\\ -1&\text x\not\in \mathbb, \end :\lceil x \rceil + \lceil -x \rceil = \begin 0&\text x\in \mathbb\\ 1&\text x\not\in \mathbb. \end Negating the argument complements the fractional part: :\ + \ = \begin 0&\text x\in \mathbb\\ 1&\text x\not\in \mathbb. \end The floor, ceiling, and fractional part functions are
idempotent Idempotence (, ) is the property of certain operations in mathematics and computer science whereby they can be applied multiple times without changing the result beyond the initial application. The concept of idempotence arises in a number of pl ...
: : \begin \big\lfloor \lfloor x \rfloor \big\rfloor &= \lfloor x \rfloor, \\ \big\lceil \lceil x \rceil \big\rceil &= \lceil x \rceil, \\ \big\ &= \. \end The result of nested floor or ceiling functions is the innermost function: : \begin \big\lfloor \lceil x \rceil \big\rfloor &= \lceil x \rceil, \\ \big\lceil \lfloor x \rfloor \big\rceil &= \lfloor x \rfloor \end due to the identity property for integers.


Quotients

If ''m'' and ''n'' are integers and ''n'' ≠ 0, :0 \le \left\ \le 1-\frac. If ''n'' is positive :\left\lfloor\frac\right\rfloor = \left\lfloor\frac\right\rfloor, :\left\lceil\frac\right\rceil = \left\lceil\frac\right\rceil. If ''m'' is positive :n=\left\lceil\frac\right\rceil + \left\lceil\frac\right\rceil +\dots+\left\lceil\frac\right\rceil, :n=\left\lfloor\frac\right\rfloor + \left\lfloor\frac\right\rfloor +\dots+\left\lfloor\frac\right\rfloor. For ''m'' = 2 these imply :n= \left\lfloor \frac\right \rfloor + \left\lceil\frac\right \rceil. More generally, for positive ''m'' (See
Hermite's identity In mathematics, Hermite's identity, named after Charles Hermite, gives the value of a summation involving the floor function. It states that for every real number ''x'' and for every positive integer ''n'' the following identity holds:. : \sum_ ...
) :\lceil mx \rceil =\left\lceil x\right\rceil + \left\lceil x-\frac\right\rceil +\dots+\left\lceil x-\frac\right\rceil, :\lfloor mx \rfloor=\left\lfloor x\right\rfloor + \left\lfloor x+\frac\right\rfloor +\dots+\left\lfloor x+\frac\right\rfloor. The following can be used to convert floors to ceilings and vice versa (with ''m'' being positive) :\left\lceil \frac \right\rceil = \left\lfloor \frac \right\rfloor = \left\lfloor \frac \right\rfloor + 1, :\left\lfloor \frac \right\rfloor = \left\lceil \frac \right\rceil = \left\lceil \frac \right\rceil - 1, For all ''m'' and ''n'' strictly positive integers: :\sum_^ \left\lfloor \frac \right\rfloor = \frac2, which, for positive and
coprime In number theory, two integers and are coprime, relatively prime or mutually prime if the only positive integer that is a divisor of both of them is 1. Consequently, any prime number that divides does not divide , and vice versa. This is equiv ...
''m'' and ''n'', reduces to :\sum_^ \left\lfloor \frac \right\rfloor = \tfrac(m - 1)(n - 1) , and similarly for the ceiling and fractional part functions (still for positive and
coprime In number theory, two integers and are coprime, relatively prime or mutually prime if the only positive integer that is a divisor of both of them is 1. Consequently, any prime number that divides does not divide , and vice versa. This is equiv ...
''m'' and ''n''), :\sum_^ \left\lceil \frac \right\rceil = \tfrac(m + 1)(n - 1), :\sum_^ \left\ = \tfrac(n - 1). Since the right-hand side of the general case is symmetrical in ''m'' and ''n'', this implies that :\left\lfloor \frac \right \rfloor + \left\lfloor \frac \right \rfloor + \dots + \left\lfloor \frac \right \rfloor = \left\lfloor \frac \right \rfloor + \left\lfloor \frac \right \rfloor + \dots + \left\lfloor \frac \right \rfloor. More generally, if ''m'' and ''n'' are positive, :\begin &\left\lfloor \frac \right \rfloor + \left\lfloor \frac \right \rfloor + \left\lfloor \frac \right \rfloor + \dots + \left\lfloor \frac \right \rfloor\\ mu= &\left\lfloor \frac \right \rfloor + \left\lfloor \frac \right \rfloor + \left\lfloor \frac \right \rfloor + \cdots + \left\lfloor \frac \right \rfloor. \end This is sometimes called a
reciprocity law In mathematics, a reciprocity law is a generalization of the law of quadratic reciprocity to arbitrary monic irreducible polynomials f(x) with integer coefficients. Recall that first reciprocity law, quadratic reciprocity, determines when an ir ...
. Division by positive integers gives rise to an interesting and sometimes useful property. Assuming m,n >0, : m \leq \left\lfloor \frac \right \rfloor \iff n \leq \left\lfloor \frac \right \rfloor \iff n \leq \frac. Similarly, : m \geq \left\lceil \frac \right \rceil \iff n \geq \left\lceil \frac \right \rceil \iff n \geq \frac. Indeed, : m \leq \left\lfloor \frac \right \rfloor \implies m \leq \frac \implies n \leq \frac \implies n \leq \left \lfloor \frac\right \rfloor \implies \ldots \implies m \leq \left\lfloor \frac \right \rfloor, keeping in mind that \left\lfloor \frac \right\rfloor = \left\lfloor \frac \right\rfloor. The second equivalence involving the ceiling function can be proved similarly.


Nested divisions

For a positive integer ''n'', and arbitrary real numbers ''m'' and ''x'': : \begin \left\lfloor \frac \right\rfloor &= \left\lfloor \frac \right\rfloor \\ px\left\lceil \frac \right\rceil &= \left\lceil \frac \right\rceil. \end


Continuity and series expansions

None of the functions discussed in this article are
continuous Continuity or continuous may refer to: Mathematics * Continuity (mathematics), the opposing concept to discreteness; common examples include ** Continuous probability distribution or random variable in probability and statistics ** Continuous ...
, but all are piecewise linear: the functions \lfloor x \rfloor, \lceil x \rceil, and \ have discontinuities at the integers. \lfloor x \rfloor is
upper semi-continuous In mathematical analysis, semicontinuity (or semi-continuity) is a property of extended real-valued functions that is weaker than continuity. An extended real-valued function f is upper (respectively, lower) semicontinuous at a point x_0 if, r ...
and \lceil x \rceil and \ are lower semi-continuous. Since none of the functions discussed in this article are continuous, none of them have a
power series In mathematics, a power series (in one variable) is an infinite series of the form \sum_^\infty a_n \left(x - c\right)^n = a_0 + a_1 (x - c) + a_2 (x - c)^2 + \dots where ''a_n'' represents the coefficient of the ''n''th term and ''c'' is a co ...
expansion. Since floor and ceiling are not periodic, they do not have uniformly convergent
Fourier series A Fourier series () is an Series expansion, expansion of a periodic function into a sum of trigonometric functions. The Fourier series is an example of a trigonometric series. By expressing a function as a sum of sines and cosines, many problems ...
expansions. The fractional part function has Fourier series expansion \= \frac - \frac \sum_^\infty \frac for not an integer. At points of discontinuity, a Fourier series converges to a value that is the average of its limits on the left and the right, unlike the floor, ceiling and fractional part functions: for ''y'' fixed and ''x'' a multiple of ''y'' the Fourier series given converges to ''y''/2, rather than to ''x'' mod ''y'' = 0. At points of continuity the series converges to the true value. Using the formula \lfloor x\rfloor = x - \ gives \lfloor x\rfloor = x - \frac + \frac \sum_^\infty \frac for not an integer.


Applications


Mod operator

For an integer ''x'' and a positive integer ''y'', the
modulo operation In computing and mathematics, the modulo operation returns the remainder or signed remainder of a Division (mathematics), division, after one number is divided by another, the latter being called the ''modular arithmetic, modulus'' of the operatio ...
, 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 :x \bmod y = x-y\left\lfloor \frac\right\rfloor. Then it follows from the definition of floor function that this extended operation satisfies many natural properties. Notably, ''x'' mod ''y'' is always between 0 and ''y'', i.e., if ''y'' is positive, :0 \le x \bmod y and if ''y'' is negative, :0 \ge x \bmod y >y.


Quadratic reciprocity

Gauss's third proof of
quadratic reciprocity In number theory, the law of quadratic reciprocity is a theorem about modular arithmetic that gives conditions for the solvability of quadratic equations modulo prime numbers. Due to its subtlety, it has many formulations, but the most standard st ...
, as modified by Eisenstein, has two basic steps. Let ''p'' and ''q'' be distinct positive odd prime numbers, and let m = \tfrac12(p - 1), n = \tfrac12(q - 1). First, Gauss's lemma is used to show that the
Legendre symbol In number theory, the Legendre symbol is a multiplicative function with values 1, −1, 0 that is a quadratic character modulo of an odd prime number ''p'': its value at a (nonzero) quadratic residue mod ''p'' is 1 and at a non-quadratic re ...
s are given by :\begin \left(\frac\right) &= (-1)^, \\ mu\left(\frac\right) &= (-1)^. \end The second step is to use a
geometric Geometry (; ) is a branch of mathematics concerned with properties of space such as the distance, shape, size, and relative position of figures. Geometry is, along with arithmetic, one of the oldest branches of mathematics. A mathematician w ...
argument to show that :\left\lfloor\frac\right\rfloor +\left\lfloor\frac\right\rfloor +\dots +\left\lfloor\frac\right\rfloor +\left\lfloor\frac\right\rfloor +\left\lfloor\frac\right\rfloor +\dots +\left\lfloor\frac\right\rfloor = mn. Combining these formulas gives quadratic reciprocity in the form :\left(\frac\right) \left(\frac\right) = (-1)^=(-1)^. There are formulas that use floor to express the quadratic character of small numbers mod odd primes ''p'': :\begin \left(\frac\right) &= (-1)^, \\ mu\left(\frac\right) &= (-1)^. \end


Rounding

For an arbitrary real number x,
rounding Rounding or rounding off is the process of adjusting a number to an approximate, more convenient value, often with a shorter or simpler representation. For example, replacing $ with $, the fraction 312/937 with 1/3, or the expression √2 with ...
x to the nearest integer with tie breaking towards positive infinity is given by :\text(x)=\left\lfloor x+\tfrac\right\rfloor = \left\lceil \tfrac12\lfloor 2x \rfloor \right\rceil; rounding towards negative infinity is given as :\text(x)=\left\lceil x-\tfrac\right\rceil = \left\lfloor \tfrac12 \lceil 2x \rceil \right\rfloor. If tie-breaking is away from 0, then the rounding function is :\text(x) = \sgn(x)\left\lfloor, x, +\tfrac\right\rfloor (where \sgn is the
sign function In mathematics, the sign function or signum function (from '' signum'', Latin for "sign") is a function that has the value , or according to whether the sign of a given real number is positive or negative, or the given number is itself zer ...
), and rounding towards even can be expressed with the more cumbersome :\lfloor x\rceil=\left\lfloor x+\tfrac\right\rfloor+\left\lceil\tfrac14(2x-1)\right\rceil-\left\lfloor\tfrac14(2x-1)\right\rfloor-1, which is the above expression for rounding towards positive infinity \text(x) minus an
integrality In commutative algebra, an element ''b'' of a commutative ring ''B'' is said to be integral over a subring ''A'' of ''B'' if ''b'' is a root of some monic polynomial over ''A''. If ''A'', ''B'' are fields, then the notions of "integral over" and ...
indicator Indicator may refer to: Biology * Environmental indicator of environmental health (pressures, conditions and responses) * Ecological indicator of ecosystem health (ecological processes) * Health indicator, which is used to describe the health o ...
for \tfrac14(2x-1). Rounding a
real number In mathematics, a real number is a number that can be used to measure a continuous one- dimensional quantity such as a duration or temperature. Here, ''continuous'' means that pairs of values can have arbitrarily small differences. Every re ...
x to the nearest integer value forms a very basic type of quantizer – a ''uniform'' one. A typical (''mid-tread'') uniform quantizer with a quantization ''step size'' equal to some value \Delta can be expressed as :Q(x) = \Delta \cdot \left\lfloor \frac + \frac \right\rfloor,


Number of digits

The number of digits in base ''b'' of a positive integer ''k'' is :\lfloor \log_ \rfloor + 1 = \lceil \log_ \rceil .


Number of strings without repeated characters

The number of possible strings of arbitrary length that doesn't use any character twice is given by :(n)_0 + \cdots + (n)_n = \lfloor e n! \rfloor where: * > 0 is the number of letters in the alphabet (e.g., 26 in English) * the
falling factorial In mathematics, the falling factorial (sometimes called the descending factorial, falling sequential product, or lower factorial) is defined as the polynomial \begin (x)_n = x^\underline &= \overbrace^ \\ &= \prod_^n(x-k+1) = \prod_^(x-k) . \end ...
(n)_k = n(n-1)\cdots(n-k+1) denotes the number of strings of length that don't use any character twice. * ! denotes the
factorial In mathematics, the factorial of a non-negative denoted is the Product (mathematics), product of all positive integers less than or equal The factorial also equals the product of n with the next smaller factorial: \begin n! &= n \times ...
of * = 2.718... is
Euler's number The number is a mathematical constant approximately equal to 2.71828 that is the base of the natural logarithm and exponential function. It is sometimes called Euler's number, after the Swiss mathematician Leonhard Euler, though this can ...
For = 26, this comes out to 1096259850353149530222034277.


Factors of factorials

Let ''n'' be a positive integer and ''p'' a positive prime number. The exponent of the highest power of ''p'' that divides ''n''! is given by a version of
Legendre's formula In mathematics, Legendre's formula gives an expression for the exponent of the largest power of a prime ''p'' that divides the factorial ''n''!. It is named after Adrien-Marie Legendre. It is also sometimes known as de Polignac's formula, a ...
:\left\lfloor\frac\right\rfloor + \left\lfloor\frac\right\rfloor + \left\lfloor\frac\right\rfloor + \dots = \frac where n = \sum_a_kp^k is the way of writing ''n'' in base ''p''. This is a finite sum, since the floors are zero when ''p''''k'' > ''n''.


Beatty sequence

The Beatty sequence shows how every positive
irrational number In mathematics, the irrational numbers are all the real numbers that are not rational numbers. That is, irrational numbers cannot be expressed as the ratio of two integers. When the ratio of lengths of two line segments is an irrational number, ...
gives rise to a partition of the
natural number In mathematics, the natural numbers are the numbers 0, 1, 2, 3, and so on, possibly excluding 0. Some start counting with 0, defining the natural numbers as the non-negative integers , while others start with 1, defining them as the positive in ...
s into two sequences via the floor function.


Euler's constant (γ)

There are formulas for Euler's constant γ = 0.57721 56649 ... that involve the floor and ceiling, e.g. :\gamma =\int_1^\infty\left(-\right)\,dx, :\gamma = \lim_ \frac \sum_^n \left( \left \lceil \frac \right \rceil - \frac \right), and : \gamma = \sum_^\infty (-1)^k \frac = \tfrac12-\tfrac13 + 2\left(\tfrac14 - \tfrac15 + \tfrac16 - \tfrac17\right) + 3\left(\tfrac18 - \cdots - \tfrac1\right) + \cdots


Riemann zeta function (ζ)

The fractional part function also shows up in integral representations of the
Riemann zeta function The Riemann zeta function or Euler–Riemann zeta function, denoted by the Greek letter (zeta), is a mathematical function of a complex variable defined as \zeta(s) = \sum_^\infty \frac = \frac + \frac + \frac + \cdots for and its analytic c ...
. It is straightforward to prove (using integration by parts) that if \varphi(x) is any function with a continuous derivative in the closed interval 'a'', ''b'' :\sum_\varphi(n) = \int_a^b\varphi(x) \, dx + \int_a^b\left(\-\tfrac12\right)\varphi'(x) \, dx + \left(\-\tfrac12\right)\varphi(a) - \left(\-\tfrac12\right)\varphi(b). Letting \varphi(n) = n^ for
real part In mathematics, a complex number is an element of a number system that extends the real numbers with a specific element denoted , called the imaginary unit and satisfying the equation i^= -1; every complex number can be expressed in the form ...
of ''s'' greater than 1 and letting ''a'' and ''b'' be integers, and letting ''b'' approach infinity gives :\zeta(s) = s\int_1^\infty\frac\,dx + \frac + \frac 1 2. This formula is valid for all ''s'' with real part greater than −1, (except ''s'' = 1, where there is a pole) and combined with the Fourier expansion for can be used to extend the zeta function to the entire complex plane and to prove its functional equation. For ''s'' = ''σ'' + ''it'' in the critical strip 0 < ''σ'' < 1, :\zeta(s)=s\int_^\infty e^(\lfloor e^\omega\rfloor - e^\omega)e^\,d\omega. In 1947
van der Pol Van der Pol (also "Van de Pol", "Van de Poll", "Van den Pol" or "Van Pol") is a Dutch, toponymic surname A toponymic surname or habitational surname or byname is a surname or byname derived from a place name,if and only if In logic and related fields such as mathematics and philosophy, "if and only if" (often shortened as "iff") is paraphrased by the biconditional, a logical connective between statements. The biconditional is true in two cases, where either bo ...
:\sum_^\infty \left(\left\lfloor\frac\right\rfloor-\left\lfloor\frac\right\rfloor\right) = 2. One may also give formulas for producing the prime numbers. For example, let ''p''''n'' be the ''n''-th prime, and for any integer ''r'' > 1, define the real number ''α'' by the sum :\alpha = \sum_^\infty p_m r^. Then :p_n = \left\lfloor r^\alpha \right\rfloor - r^\left\lfloor r^\alpha\right\rfloor. A similar result is that there is a number ''θ'' = 1.3064... (
Mills' constant In number theory, Mills' constant is defined as the smallest positive real number ''A'' such that the floor function of the double exponential function : \left\lfloor A^ \right\rfloor is a prime number for all positive natural numbers ''n''. ...
) with the property that :\left\lfloor \theta^3 \right\rfloor, \left\lfloor \theta^9 \right\rfloor, \left\lfloor \theta^ \right\rfloor, \dots are all prime.Ribenboim, p. 186 There is also a number ''ω'' = 1.9287800... with the property that :\left\lfloor 2^\omega\right\rfloor, \left\lfloor 2^ \right\rfloor, \left\lfloor 2^ \right\rfloor, \dots are all prime. Let (''x'') be the number of primes less than or equal to ''x''. It is a straightforward deduction from
Wilson's theorem In algebra and number theory, Wilson's theorem states that a natural number ''n'' > 1 is a prime number if and only if the product of all the positive integers less than ''n'' is one less than a multiple of ''n''. That is (using the notations of ...
that :\pi(n) = \sum_^n\Biggl\lfloor\frac - \left\lfloor\frac\right\rfloor\Biggr\rfloor. Also, if ''n'' ≥ 2, :\pi(n) = \sum_^n \left\lfloor \frac \right\rfloor. None of the formulas in this section are of any practical use.


Solved problems

Ramanujan submitted these problems to the ''Journal of the Indian Mathematical Society''. If ''n'' is a positive integer, prove that
  1. \left\lfloor\tfrac\right\rfloor + \left\lfloor\tfrac\right\rfloor + \left\lfloor\tfrac\right\rfloor = \left\lfloor\tfrac\right\rfloor + \left\lfloor\tfrac\right\rfloor,
  2. \left\lfloor\tfrac12 + \sqrt\right\rfloor = \left\lfloor\tfrac12 + \sqrt\right\rfloor,
  3. \left\lfloor\sqrt+ \sqrt\right\rfloor = \left\lfloor \sqrt\right\rfloor.
Some generalizations to the above floor function identities have been proven.


Unsolved problem

The study of
Waring's problem In number theory, Waring's problem asks whether each natural number ''k'' has an associated positive integer ''s'' such that every natural number is the sum of at most ''s'' natural numbers raised to the power ''k''. For example, every natural num ...
has led to an unsolved problem: Are there any positive integers ''k'' ≥ 6 such that :3^k-2^k\Bigl\lfloor \bigl(\tfrac 3 2\bigr)^k \Bigr\rfloor > 2^k-\Bigl\lfloor \bigl(\tfrac 3 2\bigr)^k \Bigr\rfloor -2 \ ?
Mahler Gustav Mahler (; 7 July 1860 – 18 May 1911) was an Austro-Bohemian Romantic composer, and one of the leading conductors of his generation. As a composer he acted as a bridge between the 19th-century Austro-German tradition and the modernism ...
has proved there can only be a finite number of such ''k''; none are known.


Computer implementations

In most programming languages, the simplest method to convert a floating point number to an integer does not do floor or ceiling, but truncation. The reason for this is historical, as the first machines used
ones' complement The ones' complement of a binary number is the value obtained by inverting (flipping) all the bits in the Binary number, binary representation of the number. The name "ones' complement" refers to the fact that such an inverted value, if added t ...
and truncation was simpler to implement (floor is simpler in
two's complement Two's complement is the most common method of representing signed (positive, negative, and zero) integers on computers, and more generally, fixed point binary values. Two's complement uses the binary digit with the ''greatest'' value as the ''s ...
). FORTRAN was defined to require this behavior and thus almost all processors implement conversion this way. Some consider this to be an unfortunate historical design decision that has led to bugs handling negative offsets and graphics on the negative side of the origin. An arithmetic right-shift of a signed integer x by n is the same as \left\lfloor \tfrac \right\rfloor. Division by a power of 2 is often written as a right-shift, not for optimization as might be assumed, but because the floor of negative results is required. Assuming such shifts are "premature optimization" and replacing them with division can break software. Many programming languages (including C, C++, C#,
Java Java is one of the Greater Sunda Islands in Indonesia. It is bordered by the Indian Ocean to the south and the Java Sea (a part of Pacific Ocean) to the north. With a population of 156.9 million people (including Madura) in mid 2024, proje ...
, Julia,
PHP PHP is a general-purpose scripting language geared towards web development. It was originally created by Danish-Canadian programmer Rasmus Lerdorf in 1993 and released in 1995. The PHP reference implementation is now produced by the PHP Group. ...
, R, and
Python Python may refer to: Snakes * Pythonidae, a family of nonvenomous snakes found in Africa, Asia, and Australia ** ''Python'' (genus), a genus of Pythonidae found in Africa and Asia * Python (mythology), a mythical serpent Computing * Python (prog ...
) provide standard functions for floor and ceiling, usually called floor and ceil, or less commonly ceiling. The language APL uses ⌊x for floor. The
J Programming Language The J programming language, developed in the early 1990s by Kenneth E. Iverson and Roger Hui, is an array programming language based primarily on APL (also by Iverson). To avoid repeating the APL special-character problem, J uses only the ba ...
, a follow-on to APL that is designed to use standard keyboard symbols, uses <. for floor and >. for ceiling.
ALGOL ALGOL (; short for "Algorithmic Language") is a family of imperative computer programming languages originally developed in 1958. ALGOL heavily influenced many other languages and was the standard method for algorithm description used by the ...
usesentier for floor. In
Microsoft Excel Microsoft Excel is a spreadsheet editor developed by Microsoft for Microsoft Windows, Windows, macOS, Android (operating system), Android, iOS and iPadOS. It features calculation or computation capabilities, graphing tools, pivot tables, and a ...
the function INT rounds down rather than toward zero, while FLOOR rounds toward zero, the opposite of what "int" and "floor" do in other languages. Since 2010 FLOOR has been changed to error if the number is negative. The
OpenDocument The Open Document Format for Office Applications (ODF), also known as OpenDocument, standardized as ISO 26300, is an open file format for word processor, word processing documents, spreadsheets, Presentation program, presentations and ...
file format, as used by
OpenOffice.org OpenOffice.org (OOo), commonly known as OpenOffice, is a discontinued open-source office suite. Active successor projects include LibreOffice (the most actively developed) and Collabora Online, with Apache OpenOffice being considered mostly d ...
,
Libreoffice LibreOffice () is a free and open-source office productivity software suite developed by The Document Foundation (TDF). It was created in 2010 as a fork of OpenOffice.org, itself a successor to StarOffice. The suite includes applications ...
and others, INT and FLOOR both do floor, and FLOOR has a third argument to reproduce Excel's earlier behavior.


See also

*
Bracket (mathematics) In mathematics, brackets of various typographical forms, such as parentheses ( ), square brackets nbsp; braces and angle brackets ⟨ ⟩, are frequently used in mathematical notation. Generally, such bracketing denotes some form of g ...
* Integer-valued function *
Step function In mathematics, a function on the real numbers is called a step function if it can be written as a finite linear combination of indicator functions of intervals. Informally speaking, a step function is a piecewise constant function having on ...
*
Modulo operation In computing and mathematics, the modulo operation returns the remainder or signed remainder of a Division (mathematics), division, after one number is divided by another, the latter being called the ''modular arithmetic, modulus'' of the operatio ...


Citations


References

* * * * *Nicholas J. Higham, ''Handbook of writing for the mathematical sciences'', SIAM. , p. 25 *
ISO The International Organization for Standardization (ISO ; ; ) is an independent, non-governmental, international standard development organization composed of representatives from the national standards organizations of member countries. Me ...
/
IEC The International Electrotechnical Commission (IEC; ) is an international standards organization that prepares and publishes international standards for all electrical, electronic and related technologies. IEC standards cover a vast range of ...
. ''ISO/IEC 9899::1999(E): Programming languages — C'' (2nd ed), 1999; Section 6.3.1.4, p. 43. * * * * *Michael Sullivan. ''Precalculus'', 8th edition, p. 86 *


External links

* * Štefan Porubský
"Integer rounding functions"
''Interactive Information Portal for Algorithmic Mathematics'', Institute of Computer Science of the Czech Academy of Sciences, Prague, Czech Republic, retrieved 24 October 2008 * * {{DEFAULTSORT:Floor And Ceiling Functions Special functions Mathematical notation Unary operations