Tag Archives: Double-single precision

My computer can’t add (part 2)

In My computer can’t add (part 1) introduced Kahan summation and showed how it helps to improve the accuracy of summing up a large number of floating point values.  Kahan’s algorithm is fine for this task, but what happens when one tries combining the result of two sums?  What if you need to multiply the compensated sum by some value?  This led to a number of searches on Google and online publishers that turned up relatively little.  What I did eventually find led me to the double-double precision and double-single precision libraries written in Fortran.  Currently, they reside at http://crd-legacy.lbl.gov/~dhbailey/mpdist/.  I am going to focus on the addition operators again, but the Fortran code shows how to handle multiplication, transcendental functions and pretty much everything else you could want. Continue reading