From 9aaec2c313c16b8b258ad76ced198230a8c98fee Mon Sep 17 00:00:00 2001
From: Martyn Gigg <martyn.gigg@stfc.ac.uk>
Date: Wed, 12 Feb 2014 11:21:46 +0000
Subject: [PATCH] Use boost::isnan to avoid cppcheck error and for clearer
 code!

Refs #8940
---
 Code/Mantid/Framework/MDAlgorithms/src/FindPeaksMD.cpp | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/Code/Mantid/Framework/MDAlgorithms/src/FindPeaksMD.cpp b/Code/Mantid/Framework/MDAlgorithms/src/FindPeaksMD.cpp
index bbcb1e53cb2..39218199627 100644
--- a/Code/Mantid/Framework/MDAlgorithms/src/FindPeaksMD.cpp
+++ b/Code/Mantid/Framework/MDAlgorithms/src/FindPeaksMD.cpp
@@ -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;
-- 
GitLab