More accurate sum


Version: 1.2
Category:
Scripts
Python
Requirements:
Seller:
Price:
-
System:
Rating:
4.6
License:

Description - More accurate sum



Built-in "sum" function, as well as add.reduce functions in Numeric/Numarray introduce a large error when summing large arrays of like elements. I got relative error of about 1e-9 after summing 10 million doubles Between 0 and 1. Function below has error less than 1e-15, doesn`t use any additional memory (although it destroys the data array), and also runs asymptotically FASTER for unlimited Precision numbers.



More in Python-More accurate sum

Large Function Error Less Than