X-Git-Url: https://git.ucc.asn.au/?p=ipdf%2Fsam.git;a=blobdiff_plain;f=chapters%2FBackground%2FRationals.tex;h=5a551985a578f552b33de7740dddd10ea3f9c97e;hp=8b137891791fe96927ad78e64b0aad7bded08bdc;hb=HEAD;hpb=9fcf44a0c34f393689118e913a2d17d907036c85 diff --git a/chapters/Background/Rationals.tex b/chapters/Background/Rationals.tex index 8b13789..5a55198 100644 --- a/chapters/Background/Rationals.tex +++ b/chapters/Background/Rationals.tex @@ -1 +1,13 @@ +A rational number $Q$ may be represented by two integers $N$ the numerator and $D$ the denominator. +\begin{align} + Q &= \frac{N}{D} +\end{align} + +Compared to floating point arithmetic which is generally inexact, rational arithmetic including the division operation is always exactly representable as another rational number. However, a \emph{fixed size} rational representation is of rather limited use as $D$ will always grow after repeated operations and overflow. Use of arbitrary sized integers as described in section \ref{Big Integers} and implemented by GMP\cite{granlund2004GMP} overcomes this issue; however as we will see in Chapter \ref{Results and Discussion} there can be a significant performance cost associated with Rationals. + + \begin{align} + N = \sum_{i=0}^{S} n_i \beta^{i} & \text{ and } + D = \sum_{i=0}^{S} d_i \beta^{i} \text{ where $S$ grows as needed} + \end{align} +