Skip to content

Commit

Permalink
Use boost::isnan to avoid cppcheck error and for clearer code!
Browse files Browse the repository at this point in the history
Refs #8940
  • Loading branch information
martyngigg committed Feb 12, 2014
1 parent 4d88a39 commit 9aaec2c
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion Code/Mantid/Framework/MDAlgorithms/src/FindPeaksMD.cpp
Expand Up @@ -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>
Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit 9aaec2c

Please sign in to comment.