JavaScript Summation Errors

JavaScript uses stores all number values in double precision floating-point format. Since double precision representations have finite precision, a small error may be introduced with every addition. These errors accumulate when summing long lists of values.

Calculate the maximum possible error when computing the sum of N values in JavaScript:


(click a button above)


Goldberg, D.; What Every Computer Scientist Should Know About Floating-Point Aritmetic; ACM Computing Surveys, Vol 23, No 1, March 1991; Section 4.3 Errors in Summation