DK96-OS / MathTools

Mathematical Software Components. This library is actively maintained, and aims to stay updated. New feature proposals are welcome, but may not be included.
Apache License 2.0
2 stars 1 forks source link

Big Sum Methods Fail To Add Negative Values #64

Closed DK96-OS closed 2 years ago

DK96-OS commented 2 years ago

The Lists module contains multiple largeSum methods and LongArrayExt contains a sum method.

These methods return either BigInteger or BigDecimal depending on the input type.

They have been created and tested with positive numbers only, until now.

A list containing only negative numbers, has produced an output of 0, and it is suspected that any negative numbers in a list would be ignored by the sum method.

DK96-OS commented 2 years ago

This is really not good for the whole library, because there are dependencies in Statistics.

The LongList largeSum method is used by calculateMean and listSum. The standardDeviation method depends on calculateMean.

Other types do not appear to be affected by this specific issue.

DK96-OS commented 2 years ago

IntList is affected by this issue in a different way. Since the minorSum is able to buffer for a large number of values, the issue does not appear quickly.

DK96-OS commented 2 years ago

Has been addressed by #62