Floor Function Article Index for
Floor
Website Links For
Floor
 

Information About

Floor Function




In ''x'', floor(''x'') is the largest Integer less than or equal to ''x''. For example, floor(2.9) = 2, floor(−2) = −2 and floor(−2.3) = −3. The floor function is also denoted by \lfloor x floor. For Nonnegative ''x'', a more traditional name for floor(''x'') is the integral part or '''integral value''' of ''x''. The function ''x''− {Link without Title} , also written as ''x''  Mod  1, is called the '''fractional part''' of ''x''. Every Fraction ''x'' can be written as a Mixed Number , the sum of an integer and a Proper Fraction . The floor function and fractional part functions extend this decomposition to all real values.


SOME PROPERTIES OF THE FLOOR FUNCTION


  • One has

  • :: \lfloor x floor \le x < \lfloor x floor + 1

:with equality on the left if and only if ''x'' is an integer.
  • The floor function is Idempotent : \lfloor\lfloor x floor floor=\lfloor x floor.

  • For any integer ''k'' and any real number ''x'',

  • : \lfloor k+x floor = k + \lfloor x floor.

  • 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 . Being a piecewise Constant Function , its Derivative is zero where it exists, that is, at all points which are not integers.

  • If ''x'' is a real number and ''n'' is an integer, one has ''n'' ≤ ''x'' ; it is the upper adjoint of the function that embeds the integers into the reals.

  • Using the floor function, one can produce several explicit (yet impractical) Formulas For Prime Numbers .



THE CEILING FUNCTION


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 not less than ''x''. For example, ceiling(2.3) = 3,
ceiling(2) = 2 and ceiling(−2.3) = −2. The ceiling function is also denoted
by \lceil x ceil. It is easy to show the following:
:\lceil x ceil = - \lfloor - x floor
and the following:
:x \leq \lceil x ceil < x + 1
For any integer ''k'', we also have the following equality:
: \lfloor k / 2 floor + \lceil k / 2 ceil = k.

If ''m'' and ''n'' are Coprime positive integers, then
:\sum_{i=1}^{n-1} \lfloor im / n floor = (m - 1) (n - 1) / 2

Beatty's Theorem shows how every positive Irrational Number gives rise to a partition of the Natural Number s into two sequences via the floor function.


THE OPERATOR <CODE>(INT)</CODE> IN C


C and related Programming Language s have a feature called Type Casting which allows to turn a Floating Point value into an integer by prefixing it with (int). This operation is a mixture of the floor and ceiling function: for positive or 0 ''x'' it returns floor(''x''), and for negative ''x'' it returns ceiling(''x'').

Like the floor and ceiling function, this operation is not continuous, which can magnify Rounding Error s with disastrous consequences. For instance, (int)(0.6/0.2) will return 2 in most implementations of C, even though 0.6/0.2 = 3. The reason is that computers work internally with the Binary Numeral System , and it is not possible to represent the numbers 0.6 and 0.2 by a finite binary string. So some rounding errors occur, and the result is computed as 2.999999999999999555910790149937 which the (int) operator will happily convert to 2. The POSIX floor() function has similar problems. Because of issues like these, most modern Calculator s use the decimal numeral system internally.


THE FRACTIONAL PART


If ''x'' is an Irrational Number , then the fractional parts ''nx'' mod 1, where ''n'' runs through the positive integers, are extremely evenly distributed in the Open Interval (0,1). This can be made precise in various ways, one of which states
:\int_0^1 f(t)\; dt = \lim_{N o\infty} rac{1}{N}\sum_{n=1}^N f(nx \;\operatorname{mod}\; 1)
for every and Integration ).

According to a general principle of Diophantine Approximation discovered by Hermann Weyl , that property is equivalent to something much easier to check in this case: namely that sums

:\sum e^{2 \pi i k n x}

for fixed integers ''k'' > 0 and taken over ranges

: 0 < ''n'' < ''N''

have estimates O(''N'') . Because these are Geometric Progression s, that can be proved rather directly. The condition that ''x'' be irrational comes out to be that

:\sin \pi k x
e 0.


TRUNCATION

While the floor function only outputs natural numbers, Truncation allows "cutting off the numbers" at a specified position.