Skip to content
Snippets Groups Projects
Commit 8ec70482 authored by Taddeüs Kroes's avatar Taddeüs Kroes
Browse files

Added Kahan documentation.

parent db6a27c2
No related branches found
No related tags found
No related merge requests found
...@@ -113,12 +113,12 @@ We've calculated $\sum_{i=1}^{N}\frac{1}{i}$ for $N = 10^8$ and $N = 2 \cdot ...@@ -113,12 +113,12 @@ We've calculated $\sum_{i=1}^{N}\frac{1}{i}$ for $N = 10^8$ and $N = 2 \cdot
\begin{table}[H] \begin{table}[H]
\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}
% }}} % }}}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment