### Integer rounding functions

#### Integer part

Let . The integer part function 1 is defined as the largest integer less or equal to , formally it is defined as . There are many notations used for this important function but none was generally adopted:

• Gauß introduced  [1] , p. 5    the bracket notation (the so-called Gauß bracket) , a notation often used in number theory
• Legendre [2] , p. 10,      (   ) denoted it by taking from the French entier
• K.E.Iverson [3]  p. 12,  introduced the half-bracket notation and called it the floor function
• in programming languages this function is often denoted by .

This function can also appear also in another form, as the truncation function, where we discard the noninteger part of a positive real number. In general, the term truncation is used for reducing the number of digits right of the decimal point. Given a positive real number to be truncated and , the number of digits to be kept behind the decimal point, the truncated value is given by

For negative real numbers truncation rounds toward zero.

If and then

• , more generally   for
• (the so-called multiplicative formula discovered by Ch. Hermite)
•
• , where is the divisor function

#### Ceiling function

When Iverson introduced his half-bracket notation for the integer part function, he also introduced very closely related ceiling function (previously often called upper integer part function)

This function is also often named as the post-office function, because of the rounding the intermediate weights up to the next scale point for postal charges.

If and then

#### The fractional part

This is actually a companion function to the integer part function, and it is usually defined as the difference between and , that is . The symbol is used for this function, especially in number theory, even if the confusion with the set theoretic meaning of the same symbol is possible.

Clearly, is a periodic function with period 1 has the following Fourier expansion

 (1)

If then we have , but if then this relation is not longer true.  To save the previous relation also for negative real numbers, the fractional part function is sometimes also defined by

#### Nearest integer function

The nearest integer function is formally defined as the closed integer to . Since this definition is not unambiguous for half-integers, the additional rule is necessary to adopt,  for instance

• to round up by taking , or
• to round down by taking , or
• to round to even numbers in order to avoid statistical biasing.

Let us take for the definition the first possibility, that is the nearest integer function denoted by is defined by  . Then

• , that is   with equality if and only if

#### Distance to the nearest integer

This function is defined by . It is a periodic function with period 1 and Fourier expansion

 (2)

### Notes

 1 Also called entier function or greatest integer function or floor function

### References

 [1] Gauß, C. F. (1808, Jan.). Theorematis arithmetici demonstratio nova. Comment. Soc. regiae sci. Göttingen , XVI, 1-8 (Werke II, p. 1-8 ).

 [2] Legendre, A. M. (1808). Théorie des nombres (ed. 2).

 [3] Iverson, K. E. (1962). A Programming Language. New York: Wiley.

Cite this web-page as:

Štefan Porubský: Integer rounding functions.

Page created  .