Commit a27f08a3 authored by Sander Mathijs van Veen's avatar Sander Mathijs van Veen

Merge branch 'master' of ssh://vo20.nl/git/uva

parents 6bf9f8ad 8ec70482
...@@ -115,10 +115,10 @@ We've calculated $\sum_{i=1}^{N}\frac{1}{i}$ for $N = 10^8$ and $N = 2 \cdot ...@@ -115,10 +115,10 @@ We've calculated $\sum_{i=1}^{N}\frac{1}{i}$ for $N = 10^8$ and $N = 2 \cdot
\begin{tabular}{l|llll} \begin{tabular}{l|llll}
Type & N & Forward & Backward & Kahan\\ Type & N & Forward & Backward & Kahan\\
\hline \hline
\texttt{float} & $10^8$ & $15.40368$ & $18.80792$ & $18.99790$ \\ \texttt{float} & $10^8$ & $15.403683$ & $18.807919$ & $18.997896$ \\
\texttt{float} & $2 \cdot 10^8$ & $15.40368$ & $18.80792$ & $19.69104$ \\ \texttt{float} & $2 \cdot 10^8$ & $15.403683$ & $18.807919$ & $19.691044$ \\
\texttt{double} & $10^8$ & $18.99790$ & $18.99790$ & \\ \texttt{double} & $10^8$ & $18.997896$ & $18.997896$ & \\
\texttt{double} & $2 \cdot 10^8$ & $19.69104$ & $19.69104$ & \\ \texttt{double} & $2 \cdot 10^8$ & $19.691044$ & $19.691044$ & \\
\end{tabular} \end{tabular}
\caption{Results of various summation approaches on floats and doubles.} \caption{Results of various summation approaches on floats and doubles.}
\end{table} \end{table}
...@@ -150,7 +150,14 @@ Type & N & Forward & Backward & Kahan\\ ...@@ -150,7 +150,14 @@ Type & N & Forward & Backward & Kahan\\
\frac{1}{2 \cdot 10^8}]$ are also represented as zero and therefore not added \frac{1}{2 \cdot 10^8}]$ are also represented as zero and therefore not added
to the result. to the result.
\item To improve the precision of the \texttt{float} data type summation, we \item To improve the precision of the \texttt{float} data type summation, we
implemented the Kahan summation algorithm. implemented the Kahan summation algorithm. This algorithm basically divides the
summation in a higher- and lower-order part. The lower-order part is used to
compensate for the error at each summation. See
\url{http://en.wikipedia.org/wiki/Kahan\_summation\_algorithm} for more
information about this algorithm. The results are in the last column as the
table, we can see that the algorithm yields the correct number. We know this
because they are equal to the result of the \texttt{double} summations (but
rounded to the precision of a \texttt{float}, of course).
\end{itemize} \end{itemize}
% }}} % }}}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment