Skip to content
Snippets Groups Projects
Commit 9aaec2c3 authored by Gigg, Martyn Anthony's avatar Gigg, Martyn Anthony
Browse files

Use boost::isnan to avoid cppcheck error and for clearer code!

Refs #8940
parent 4d88a394
No related branches found
No related tags found
No related merge requests found
......@@ -27,6 +27,7 @@ It may give better results on [[Workspace2D]]'s that were converted to [[MDWorks
#include "MantidMDEvents/MDHistoWorkspace.h"
#include "MantidKernel/VMD.h"
#include <boost/math/special_functions/fpclassify.hpp>
#include <boost/type_traits/integral_constant.hpp>
#include <map>
......@@ -317,7 +318,7 @@ namespace MDAlgorithms
// Calculate a threshold below which a box is too diffuse to be considered a peak.
signal_t thresholdDensity = ws->getBox()->getSignalNormalized() * DensityThresholdFactor * m_densityScaleFactor;
if ((thresholdDensity != thresholdDensity) || (thresholdDensity == std::numeric_limits<double>::infinity())
if ( boost::math::isnan(thresholdDensity) || (thresholdDensity == std::numeric_limits<double>::infinity())
|| (thresholdDensity == -std::numeric_limits<double>::infinity()))
{
g_log.warning() << "Infinite or NaN overall density found. Your input data may be invalid. Using a 0 threshold instead." << std::endl;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment