This fixes the problem that cases which have values exactly at the upper
bin limit of the upper bin are not included in the binning. The fix
is based on the idea from John to just add another bin when the bin
limit is just equal to the maximum case value.
nbins = ceil((max-*adjusted_min)/binwidth);
*adjusted_max = nbins*binwidth + *adjusted_min;
+ /* adjusted_max should never be smaller than max but if it is equal
+ then the gsl_histogram will not add the cases which have max value */
+ if (*adjusted_max <= max)
+ {
+ *adjusted_max += binwidth;
+ nbins++;
+ }
+ assert (*adjusted_min <= min);
+
return nbins;
}