diff --git a/hist/hist/src/THLimitsFinder.cxx b/hist/hist/src/THLimitsFinder.cxx index 700e1aa9534a4..2a6a709bf12cd 100644 --- a/hist/hist/src/THLimitsFinder.cxx +++ b/hist/hist/src/THLimitsFinder.cxx @@ -382,8 +382,9 @@ void THLimitsFinder::OptimizeLimits(Int_t nbins, Int_t &newbins, Double_t &xmin, xmin = -1; xmax = 1; } else { - xmin = std::min(binlow, xmin - 0.01 * (xmax - xmin)); - xmax = std::max(binhigh, xmax + 0.01 * (xmax - xmin)); + const auto delta = 0.01 * (xmax - xmin); + xmin = std::min(binlow, xmin - delta); + xmax = std::max(binhigh, xmax + delta); } if (isInteger) { Long64_t ixmin = Long64_t(xmin);