Scan fix: cs #17, implicit narrowing

This commit is contained in:
jeffbanks 2023-01-05 18:30:10 -06:00
parent f8eecd541e
commit 11e4c8cc49

View File

@ -309,6 +309,7 @@ public class AggregateSummaryStatistics implements StatisticalSummary,
* @param statistics collection of SummaryStatistics to aggregate * @param statistics collection of SummaryStatistics to aggregate
* @return summary statistics for the combined dataset * @return summary statistics for the combined dataset
*/ */
// TODO - we need a unit test around this one.
public static StatisticalSummaryValues aggregate(Collection<? extends StatisticalSummary> statistics) { public static StatisticalSummaryValues aggregate(Collection<? extends StatisticalSummary> statistics) {
if (statistics == null) { if (statistics == null) {
return null; return null;
@ -335,7 +336,7 @@ public class AggregateSummaryStatistics implements StatisticalSummary,
} }
sum += current.getSum(); sum += current.getSum();
final double oldN = n; final double oldN = n;
final double curN = current.getN(); final long curN = current.getN();
n += curN; n += curN;
final double meanDiff = current.getMean() - mean; final double meanDiff = current.getMean() - mean;
mean = sum / n; mean = sum / n;