Unverified Commit a69d4f7e authored by Peterson, Peter's avatar Peterson, Peter Committed by GitHub
Browse files

Merge pull request #30510 from mantidproject/30437_check_numeric_limits_min_usage

Check usage of numerical_limits<double>::min() vs numerical_limits<double>::lowest()
parents f61a098f 4c281b72
......@@ -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()
......
......@@ -94,7 +94,7 @@ void ConvertAxesToRealSpace::exec() {
axisVector[1].label = vAxis;
axisVector[1].bins = getProperty("NumberVerticalBins");
for (int axisIndex = 0; axisIndex < 2; ++axisIndex) {
axisVector[axisIndex].max = std::numeric_limits<double>::min();
axisVector[axisIndex].max = std::numeric_limits<double>::lowest();
axisVector[axisIndex].min = std::numeric_limits<double>::max();
}
......
......@@ -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,
......
Markdown is supported
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