[geos-commits] r2043 - trunk/source/algorithm

svn_geos at osgeo.org svn_geos at osgeo.org
Mon Dec 17 18:05:42 EST 2007


Author: mloskot
Date: 2007-12-17 18:05:42 -0500 (Mon, 17 Dec 2007)
New Revision: 2043

Modified:
   trunk/source/algorithm/HCoordinate.cpp
Log:
Replaced finite function with std::numeric_limits (Ticket #162).

Modified: trunk/source/algorithm/HCoordinate.cpp
===================================================================
--- trunk/source/algorithm/HCoordinate.cpp	2007-12-17 21:52:13 UTC (rev 2042)
+++ trunk/source/algorithm/HCoordinate.cpp	2007-12-17 23:05:42 UTC (rev 2043)
@@ -24,19 +24,11 @@
 #include <geos/platform.h>
 
 #include <memory>
-#include <cmath> // for finite()
+#include <cmath>
+#include <limits>
 #include <iostream>
 #include <iomanip>
 
-// For MingW builds with __STRICT_ANSI__ (-ansi)
-// See: http://geos.refractions.net/pipermail/geos-devel/2006-June/002342.html
-#if defined(__MINGW32__)
-extern "C" {
-int __cdecl _finite (double);
-#define finite(x) _finite(x)
-}
-#endif
-
 #ifndef GEOS_DEBUG
 #define GEOS_DEBUG 0
 #endif
@@ -193,8 +185,7 @@
 {
 	long double a = x/w;
 
-	// finite() also checks for NaN
-	if ( ! finite(static_cast<double>(a)) )
+    if (std::fabs(a) > std::numeric_limits<double>::max())
 	{
 		throw  NotRepresentableException();
 	}
@@ -207,8 +198,7 @@
 {
 	long double a = y/w;
 
-	// finite() also checks for NaN
-	if ( ! finite(static_cast<double>(a)) )
+    if (std::fabs(a) > std::numeric_limits<double>::max())
 	{
 		throw  NotRepresentableException();
 	}



More information about the geos-commits mailing list