X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Fmath%2Fhistogram.c;h=8aaa16f9e0a684bca8333fee51d6c6874319a69b;hb=369c24f1d085a41ec274ebae5fc198fcee567653;hp=60adaa92d1b1c92e65763223cd26ce6ec9fb621a;hpb=d2b2641dcadcdceede8be06df48739b11828b313;p=pspp diff --git a/src/math/histogram.c b/src/math/histogram.c index 60adaa92d1..8aaa16f9e0 100644 --- a/src/math/histogram.c +++ b/src/math/histogram.c @@ -119,6 +119,15 @@ hist_find_pretty_no_of_bins(double bin_width_in, double min, double max, 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; }