Fractional part

From HandWiki
Short description: Excess of a non-negative real number beyond its integer part
Graph of the fractional part of real numbers

The fractional part or decimal part[1] of a non‐negative real number [math]\displaystyle{ x }[/math] is the excess beyond that number's integer part. The latter is defined as the largest integer not greater than x, called floor of x or [math]\displaystyle{ \lfloor x\rfloor }[/math]. Then, the fractional part can be formulated as a difference:

[math]\displaystyle{ \operatorname{frac} (x)=x - \lfloor x \rfloor,\; x \gt 0 }[/math].

For a positive number written in a conventional positional numeral system (such as binary or decimal), its fractional part hence corresponds to the digits appearing after the radix point. The result is a real number in the half-open interval [0, 1).

For negative numbers

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 [math]\displaystyle{ \operatorname{frac} (x)=x-\lfloor x \rfloor }[/math] (Graham Knuth),[2] or as the part of the number to the right of the radix point [math]\displaystyle{ \operatorname{frac} (x)=|x|-\lfloor |x| \rfloor }[/math] (Daintith 2004),[3] or by the odd function:[4]

[math]\displaystyle{ \operatorname{frac} (x)=\begin{cases} x - \lfloor x \rfloor & x \ge 0 \\ x - \lceil x \rceil & x \lt 0 \end{cases} }[/math]

with [math]\displaystyle{ \lceil x \rceil }[/math] 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 straightforward way by

[math]\displaystyle{ \operatorname{frac} (x)= x - \lfloor |x| \rfloor \cdot \sgn(x) }[/math].

The [math]\displaystyle{ x - \lfloor x \rfloor }[/math] and the "odd function" definitions permit for unique decomposition of any real number x to the sum of its integer and fractional parts, where "integer part" refers to [math]\displaystyle{ \lfloor x \rfloor }[/math] or [math]\displaystyle{ \lfloor |x| \rfloor \cdot \sgn(x) }[/math] respectively. These two definitions of fractional-part function also provide idempotence.

The fractional part defined via difference from ⌊ ⌋ is usually denoted by curly braces:

[math]\displaystyle{ \{ x \} := x-\lfloor x \rfloor. }[/math]

Relation to continued fractions

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. "Decimal part". OxfordDictionaries.com. https://en.oxforddictionaries.com/definition/decimal_part. 
  2. 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 
  3. Daintith, John (2004), A Dictionary of Computing, Oxford University Press 
  4. Weisstein, Eric W. "Fractional Part." From MathWorld--A Wolfram Web Resource