The bug report wasn't specific enough to know that this fixes
the problem, which was an assertion failure for
assert (*adjusted_min <= min);
in hist_find_pretty_no_of_bins().
Thanks to Stefan Huber for reporting these bugs.
double *lower, double *interval,
int *n_ticks)
{
- int i;
double fitness = DBL_MAX;
double logrange;
*n_ticks = 0;
logrange = floor(log10(high-low));
/* Find the most pleasing interval */
- for (i = 1; i < 4; ++i)
+ for (int i = 0; i < sizeof standard_tick / sizeof *standard_tick; i++)
{
double cinterval = standard_tick[i] * pow(10.0,logrange-1);
double clower = floor(low/cinterval) * cinterval;
*adjusted_min = floor((min - lower)/binwidth)*binwidth + lower;
}
+ /* This should not happen, but sometimes it does. */
+ if (*adjusted_min > min)
+ *adjusted_min = min;
+
nbins = ceil((max-*adjusted_min)/binwidth);
*adjusted_max = nbins*binwidth + *adjusted_min;