Subsection 6.2.3 Models of floating point computation
¶When computing with floating point numbers on a target computer, we will assume that all (floating point) arithmetic that is performed is in terms of additions, subtractions, multiplications, and divisions: \(\left\{ +, -, \times, / \right\}\text{.}\)
Subsubsection 6.2.3.1 Notation
¶In our discussions, we will distinguish between exact and computed quantities. The function \(\fl{ {\rm expression} }\) returns the result of the evaluation of \({\rm expression} \text{,}\) where every operation is executed in floating point arithmetic. For example, given \(\chi, \psi, \zeta, \omega \in F \) and assuming that the expressions are evaluated from left to right and order of operations is obeyed,
is equivalent to
Equality between the quantities \({\rm lhs} \) and \({\rm rhs} \) is denoted by \(lhs = rhs\text{.}\) Assignment of \(rhs \) to \(lhs \) is denoted by \(lhs \becomes rhs\) (\(lhs \) becomes \(rhs\)). In the context of a program, the statements \(lhs := rhs\) and \(lhs := \fl{ {\rm rhs} }\) are equivalent. Given an assignment
we use the notation \(\check \kappa\) (pronounced "check kappa") to denote the quantity resulting from \(\fl{ \mbox{expression} }\text{,}\) which is actually stored in the variable \(\kappa\text{:}\)
Remark 6.2.3.1.
In future discussion, we will use the notation \([ \cdot ] \) as shorthand for \(\fl{ \cdot } \text{.}\)
Subsubsection 6.2.3.2 Standard Computational Model (SCM)
¶The Standard Computational Model (SCM) assumes that, for any two floating point numbers \(\chi\) and \(\psi\text{,}\) the basic arithmetic operations satisfy the equality
The quantity \(\epsilon\) is a function of \(\chi, \psi\) and \({\rm op}\text{.}\) Sometimes we add a subscript \((\epsilon_+, \epsilon_*, \cdots)\) to indicate what operation generated the \((1 + \epsilon)\) error factor. We always assume that all the input variables to an operation are floating point numbers.
Remark 6.2.3.2.
We can interpret the SCM as follows: These operations are performed exactly and it is only in storing the result that a roundoff error occurs.
What really happens is that enough digits of the result are computed so that the net effect is as if the result of the exact operation was stored.
Given \(\chi, \psi \in F \text{,}\) performing any operation \({\rm op} \in \{ +, -, *, / \} \) with \(\chi \) and \(\psi \) in floating point arithmetic, \(\fl{ \chi\ {\rm op}\ \psi } \) yields a result that is correct up to machine precision: Let \(\zeta = \chi\ {\rm op}\ \psi \) and \(\check \zeta = \zeta + \delta\!\zeta = \fl{ \chi\ {\rm op}\ \psi } \text{.}\) Then \(\vert \delta\!\zeta \vert \leq \meps \vert \zeta \vert \) and hence \(\check \zeta \) is close to \(\zeta \) (it has \(k \) correct binary digits).
Example 6.2.3.3.
Consider the operation
where we notice that both \(4 \) and \(3 \) can be exactly represented in our floating point system with \(\beta = 2 \) and \(t = 4 \text{.}\) Recall that the real number \(4/3 = 1.3333\cdots \) is stored as \(.1010 \times 2^1, \) if \(t = 4 \) and truncation is employed. This equals \(1.25 \) in decimal representation. The relative error was \(0.0625 \text{.}\) Now
where
Subsubsection 6.2.3.3 Alternative Computational Model (ACM)
¶For certain problems it is convenient to use the Alternative Computational Model (ACM) [21], which also assumes for the basic arithmetic operations that
As for the standard computation model, the quantity \(\epsilon\) is a function of \(\chi, \psi\) and \(\mbox{\rm op}\text{.}\) Note that the \(\epsilon\)'s produced using the standard and alternative models are generally not equal. The Taylor series expansion of \(1/(1+\epsilon) \) is given by
which explains how the SCM and ACM are related.
The ACM is useful when analyzing algorithms that involve division. In this course, we don't analyze in detail any such algorithms. We include this discussion of ACM for completeness.
Remark 6.2.3.4.
Sometimes it is more convenient to use the SCM and sometimes the ACM. Trial and error, and eventually experience, will determine which one to use.