18#include "BinGeneration.hh"
19#include "RBDSException.hh"
27std::vector<double> RBDS::LogSpace(
double start,
31 bool includeLastPoint)
33 if (start <= std::numeric_limits<double>::min_exponent10 + 1)
34 {
throw RBDSException(
"Lower limit of log binning (" + std::to_string(start) +
") is too low to represent as a double in C++");}
35 if (stop >= std::numeric_limits<double>::max_exponent10 - 1)
36 {
throw RBDSException(
"Upper limit of log binning (" + std::to_string(stop) +
") is too high to represent as a double in C++");}
38 double realStart = std::pow(base, start);
39 double realBase = std::pow(base, (stop-start)/nBins);
41 std::vector<double> result;
42 int n = includeLastPoint ? nBins+1 : nBins;
51 bool includeLastPoint)
53 std::vector<double> result;
54 int n = includeLastPoint ? nBins+1 : nBins;
56 double step = (stop - start) / (
double)nBins;
58 for (
double value = start; i < n; value += step, i++)
59 {result.push_back(value);}
General exception with possible name of object and message.
std::vector< double > LinSpace(double start, double stop, int nBins, bool includeLastPoint=true)
Linear range of values.