Skip to content

Commit

Permalink
Add guard for deviation -> Infinity
Browse files Browse the repository at this point in the history
  • Loading branch information
Morten Haraldsen committed Sep 12, 2024
1 parent 7240712 commit 9eab310
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,10 @@ public Duration getStandardDeviation()
{
final IndexedCollection<Long> list = collectionStatistics.getList();
final int count = list.size();
if (count == 0)
{
return Duration.ZERO;
}
final double average = getAverage().toNanos();
BigDecimal sd = BigDecimal.valueOf(0);
for (long l : list)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ public Double getStandardDeviation()
final int count = list.size();
if (count == 0)
{
return null;
return 0D;
}
final double average = getAverage();
BigDecimal sd = BigDecimal.valueOf(0);
Expand Down

0 comments on commit 9eab310

Please sign in to comment.