← Back to team overview

kicad-developers team mailing list archive

[PATCH 08/11] Use numeric_limits for NaN constant

 

The NAN macro is not necessarily defined in math.h, so use
std::numeric_limits to look up an appropriate value.
---
 common/gal/color4d.cpp | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/common/gal/color4d.cpp b/common/gal/color4d.cpp
index 3b509d3..3a19dc5 100644
--- a/common/gal/color4d.cpp
+++ b/common/gal/color4d.cpp
@@ -26,6 +26,8 @@
 
 #include <gal/color4d.h>
 
+#include <limits>
+
 using namespace KIGFX;
 
 COLOR4D::COLOR4D( EDA_COLOR_T aColor )
@@ -81,7 +83,7 @@ void COLOR4D::ToHSV( double& aOutH, double& aOutS, double& aOutV ) const
     {
         // r = g = b = 0                        // s = 0, v is undefined
         aOutS = 0.0;
-        aOutH = NAN;                            // its now undefined
+        aOutH = std::numeric_limits<double>::quiet_NaN(); // its now undefined
         return;
     }
 

Follow ups

References