THE FINAL COUNTDOWN
[ipdf/sam.git] / chapters / Background / Floats / Operations.tex
1
2
3 Real values which cannot be represented exactly in a floating point representation must be rounded to the nearest floating point value. The results of a floating point operation will in general be such values and thus there is a rounding error possible in any floating point operation\cite{HFP,ieee754std2008, goldberg1991whatevery}. 
4
5 Referring to Figure \ref{floats.pdf} it can be seen that the largest possible rounding error is half the distance between successive floats; this means that rounding errors increase as the value to be represented increases. For the result of a particular operation, the maximum possible rounding error can be determined and is commonly expressed in ``units in the last place'' (ulp), with 1 ulp equivelant to half the distance between successive floats\cite{goldberg1991whatevery}.
6
7
8
9 \begin{comment}
10
11 Floating point operations can in principle be performed using integer operations, but specialised Floating Point Units (FPUs) are an almost universal component of modern processors\cite{kelley1997acmos}. The improvement of FPUs remains highly active in several areas including: efficiency\cite{seidel2001onthe}; accuracy of operations\cite{dieter2007lowcost}; and even the adaptation of algorithms originally used in software, such as Kahan's Fast2Sum algorithm\cite{kadric2013accurate}. 
12
13
14 {\bf Put this stuff in an Appendix?}
15 \subsection{Addition and Subtraction}
16
17 According to the IEEE-754 standard, if $e_1 < e_2$, then the preferred form of $f_1 + f_2$ is:
18 \begin{align}
19         m_1 \beta^{e_1} \pm m_2 \beta^{e_2} &= (m_1 \pm \beta^{e_2 - e_1} m_2) \beta^{e_1}
20 \end{align}
21
22 This is equivelant to shifting the fixed point in $m_2$ by $e_2 - e_1$ to the left, and then performing fixed point addition or subtraction. If the result of the addition/subtraction requires a carry/borrow, divide result by $\beta$ (ie: shift digits by $1$ the right) and increment/decrement exponent. Then normalise the result (subtract leading zeros in mantissa from the exponent). Lastly perform the rounding operation; if this would generate a carry/borrow, shift right and increment/decrement exponent again, repeat.
23
24
25 \subsection{Multiplication and Division}
26 \begin{align}
27         m_1 \beta^{e_1} \times m_2 \beta^{e_2} &= (m_1 \times m_2 ) \beta^{e_1 + e_2}
28 \end{align}
29
30 \begin{align}
31         m_1 \beta^{e_1} \div m_2 \beta^{e_2} &= (m_1 \div m_2 ) \beta^{e_1 - e_2}
32 \end{align}
33
34 Multiplication and Division are not inverses.
35
36 \end{comment}

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