19#include "BinGeneration.hh"
20#include "RBDSException.hh"
28std::vector<double> RBDS::LogSpace(
double start,
32 bool includeLastPoint)
34 if (start <= std::numeric_limits<double>::min_exponent10 + 1)
35 {
throw RBDSException(
"Lower limit of log binning (" + std::to_string(start) +
") is too low to represent as a double in C++");}
36 if (stop >= std::numeric_limits<double>::max_exponent10 - 1)
37 {
throw RBDSException(
"Upper limit of log binning (" + std::to_string(stop) +
") is too high to represent as a double in C++");}
39 double realStart = std::pow(base, start);
40 double realBase = std::pow(base, (stop-start)/nBins);
42 std::vector<double> result;
43 int n = includeLastPoint ? nBins+1 : nBins;
52 bool includeLastPoint)
54 std::vector<double> result;
55 int n = includeLastPoint ? nBins+1 : nBins;
57 double step = (stop - start) / (
double)nBins;
59 for (
double value = start; i < n; value += step, i++)
60 {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.