Commit f76886a9 authored by Stephen's avatar Stephen
Browse files

Change usage of min() to lowest()

Changes the usage of numerical_limits<double>::min() to lowest() in cases where negatives values data may be permitted. In this case using min() to initialise the max value may lead to the max value being 0.00 rather than the maximum negative value of the data.
parent 955f291b
......@@ -78,7 +78,7 @@ void CalculateDynamicRange::calculateQMinMax(
const std::string &compName = "") {
const auto &spectrumInfo = workspace->spectrumInfo();
double min = std::numeric_limits<double>::max(),
max = std::numeric_limits<double>::min();
max = std::numeric_limits<double>::lowest();
// PARALLEL_FOR_NO_WSP_CHECK does not work with range-based for so NOLINT this
// block
PARALLEL_FOR_NO_WSP_CHECK()
......
......@@ -220,7 +220,7 @@ const BoundingBox &getBoundingBox(const std::vector<Kernel::V3D> &vertices,
static const double MinThickness = 0.001;
double minX, maxX, minY, maxY, minZ, maxZ;
minX = minY = minZ = std::numeric_limits<double>::max();
maxX = maxY = maxZ = std::numeric_limits<double>::min();
maxX = maxY = maxZ = std::numeric_limits<double>::lowest();
// Loop over all vertices and determine minima and maxima on each axis
for (const auto &vertex : vertices) {
......
......@@ -395,7 +395,7 @@ void Cylinder::getBoundingBox(double &xmax, double &ymax, double &zmax,
}
if (!listOfPoints.empty()) {
xmin = ymin = zmin = std::numeric_limits<double>::max();
xmax = ymax = zmax = std::numeric_limits<double>::min();
xmax = ymax = zmax = std::numeric_limits<double>::lowest();
for (std::vector<V3D>::const_iterator it = listOfPoints.begin();
it != listOfPoints.end(); ++it) {
// std::cout<<(*it)<<'\n';
......
......@@ -408,7 +408,7 @@ void Plane::getBoundingBox(double &xmax, double &ymax, double &zmax,
// std::cout<<listOfPoints.size()<<'\n';
if (!listOfPoints.empty()) {
xmin = ymin = zmin = std::numeric_limits<double>::max();
xmax = ymax = zmax = -std::numeric_limits<double>::max();
xmax = ymax = zmax = std::numeric_limits<double>::lowest();
for (std::vector<V3D>::const_iterator it = listOfPoints.begin();
it != listOfPoints.end(); ++it) {
// std::cout<<(*it)<<'\n';
......
......@@ -63,7 +63,7 @@ AttenuationProfile::AttenuationProfile(const std::string &inputFileName,
if (input) {
std::string line;
double minX = std::numeric_limits<double>::max();
double maxX = std::numeric_limits<double>::min();
double maxX = std::numeric_limits<double>::lowest();
while (std::getline(input, line)) {
double x, alpha, error;
if (std::stringstream(line) >> x >> alpha >> error) {
......@@ -82,7 +82,7 @@ AttenuationProfile::AttenuationProfile(const std::string &inputFileName,
0, extrapolationMaterial->attenuationCoefficient(0));
}
if ((maxX < extrapolationMaxX) &&
(maxX > std::numeric_limits<double>::min())) {
(maxX > std::numeric_limits<double>::lowest())) {
m_Interpolator.addPoint(
extrapolationMaxX,
extrapolationMaterial->attenuationCoefficient(extrapolationMaxX));
......
......@@ -60,7 +60,7 @@ public:
/// Invalid workspace index in detector index to workspace index lookup
static constexpr size_t INVALID_INDEX = std::numeric_limits<size_t>::max();
/// Value that indicates this pixel data is invalid
static constexpr double INVALID_VALUE = -std::numeric_limits<double>::max();
static constexpr double INVALID_VALUE = std::numeric_limits<double>::lowest();
/// Constructor
InstrumentActor(const QString &wsName, bool autoscaling = true,
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment