code: Double getSum() {
        if (count == 0) {
           return null;
        }
        // Better error bounds to add both terms as the final sum
        double tmp = sum + sumCompensation;
        if (Double.isNaN(tmp) && Double.isInfinite(simpleSum)) {
           // If the compensated sum is spuriously NaN from
           // accumulating one or more same-signed infinite values,
           // return the correctly-signed infinity stored in simpleSum.
           return simpleSum;
        } else {
           return tmp;
        }
     }
docs: Returns the sum of seen values. If any value is a NaN or the sum is at any point a NaN then the average will be
  NaN. The average returned can vary depending upon the order in which values are seen.
  
  @return the sum of values