THE FINAL COUNTDOWN
[ipdf/sam.git] / chapters / Background / Rationals.tex
1 A rational number $Q$ may be represented by two integers $N$ the numerator and $D$ the denominator.
2
3 \begin{align}
4         Q &= \frac{N}{D} 
5 \end{align}                     
6
7 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.
8   
9         \begin{align}
10                 N = \sum_{i=0}^{S} n_i \beta^{i} & \text{ and }
11                 D = \sum_{i=0}^{S} d_i \beta^{i} \text{ where $S$ grows as needed}
12         \end{align}     
13         

UCC git Repository :: git.ucc.asn.au