Fractional part

The fractional part of a non‐negative real number x is the excess beyond that number's integer part. If the latter is defined as the largest integer not greater than x, called floor of x or \lfloor x\rfloor, its fractional part can be written as:

\operatorname{frac} (x)=x - \lfloor x \rfloor,\; x > 0.

For a positive number written in a conventional positional numeral system (such as binary or decimal), its fractional part hence equals the digits appearing after the radix point, equivalently, it equals the original number with the digits before the radix point substituted with 0.

However, in case of negative numbers, there are various conflicting ways to extend the fractional part function to them: It is either defined in the same way as for positive numbers, i.e. by \operatorname{frac} (x)=x-\lfloor x \rfloor (Graham, Knuth & Patashnik 1992),[1] or as the part of the number to the right of the radix point, \operatorname{frac} (x)=|x|-\lfloor |x| \rfloor (Daintith 2004),[2] finally, by the odd function [3]

\operatorname{frac} (x)=\begin{cases}
x - \lfloor x \rfloor & x \ge 0 \\
x - \lceil x \rceil & x < 0
\end{cases}

with  \lceil x \rceil as the smallest integer not less than x, also called the ceiling of x. By consequence, we may get, for example, three different values for the fractional part of just one x: let it be −1.3, its fractional part will be 0.7 according to the first definition, 0.3 according to the second definition, and −0.3 according to the third definition, whose result can also be obtained in a straight-forward way by

\operatorname{frac} (x)= x - \lfloor |x| \rfloor \cdot \sgn(x).

Under the first definition all real numbers can be written in the form n+r, where n is the number to the left of the radix point, and the remaining fractional part r is a nonnegative real number less than one. If x is a positive rational number, then the fractional part of x can be expressed in the form p/q, where p and q are integers and 0 \le p < q. For example, if x=1.05, then the fractional part of x is 0.05 and can be expressed as 5/100=1/20.

Every real number can be essentially uniquely represented as a continued fraction, namely as the sum of its integer part and the reciprocal of its fractional part which is written as the sum of its integer part and the reciprocal of its fractional part, and so on.

See also

References

  1. Graham, Ronald L.; Knuth, Donald E.; Patashnik, Oren (1992), concrete mathematics: a foundation for computer science, addison-wesley, p. 70, ISBN 0-201-14236-8
  2. John Daintith (2004). a dictionary of computing. oxford university press.
  3. Weisstein, Eric W. "Fractional Part." From MathWorld--A Wolfram Web Resource


This article is issued from Wikipedia - version of the Wednesday, May 04, 2016. The text is available under the Creative Commons Attribution/Share Alike but additional terms may apply for the media files.