Skip to content

Commit

Permalink
Fix computation of number of bins when infinity is present
Browse files Browse the repository at this point in the history
  • Loading branch information
aherbert committed Sep 21, 2023
1 parent fd485f5 commit 031fd97
Showing 1 changed file with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -763,8 +763,9 @@ int getOrComputeNumberOfBins(double[] limits, double[] values) {
bins = getBinsSqrtRule(data.size());
break;
}
// In case of error (N=0 or Infinity in the data range)
if (bins == Integer.MAX_VALUE) {
// In case of error (N=0 or Infinity/NaN in the data range)
// Check for bins=0 and bins=MAX_VALUE using overflow trick
if (bins + 1 <= 1) {
bins = getBinsSqrtRule(data.size());
}
}
Expand Down

0 comments on commit 031fd97

Please sign in to comment.