]> granicus.if.org Git - postgis/commitdiff
yet another Infinite check used: finite() - which checks for NaN,-Inf,+Inf
authorSandro Santilli <strk@keybit.net>
Thu, 3 Jun 2004 08:19:20 +0000 (08:19 +0000)
committerSandro Santilli <strk@keybit.net>
Thu, 3 Jun 2004 08:19:20 +0000 (08:19 +0000)
git-svn-id: http://svn.osgeo.org/postgis/trunk@572 b70326c6-7e19-0410-871a-916f4a2858ee

postgis_gist_72.c
postgis_inout.c

index ecf967ca0521ee137c5cdb444b579153786bbe84..e4ee432f4b8aceae94018add64fddc37e42a5d6a 100644 (file)
@@ -11,6 +11,9 @@
  *
  **********************************************************************
  * $Log$
+ * Revision 1.17  2004/06/03 08:19:20  strk
+ * yet another Infinite check used: finite() - which checks for NaN,-Inf,+Inf
+ *
  * Revision 1.16  2004/06/03 08:13:11  strk
  * Simplified INFINITY checks by use of isinf()
  *
@@ -145,7 +148,6 @@ Datum ggeometry_compress(PG_FUNCTION_ARGS)
 {
        GISTENTRY *entry=(GISTENTRY*)PG_GETARG_POINTER(0);
        GISTENTRY *retval;
-       double checkinf;
 
        if ( entry->leafkey)
        {
@@ -170,9 +172,10 @@ Datum ggeometry_compress(PG_FUNCTION_ARGS)
                                PG_RETURN_POINTER(entry);
                        }
 
-                       checkinf = in->bvol.URT.x - in->bvol.URT.y -
-                               in->bvol.LLB.x - in->bvol.LLB.y;
-                       if ( isnan(checkinf) || isinf(checkinf) )
+                       if ( ! finite(in->bvol.URT.x) ||
+                               ! finite(in->bvol.URT.y) ||
+                               ! finite(in->bvol.LLB.x) ||
+                               ! finite(in->bvol.LLB.y) )
                        {
                                //elog(NOTICE, "found infinite geometry");
                                PG_RETURN_POINTER(entry);
index 17abbffebf981006ceb2dc8fcc927a6e250ba007..11e9f2a5ed36d40fa9783fd64d7cab1312feedb9 100644 (file)
@@ -11,6 +11,9 @@
  *
  **********************************************************************
  * $Log$
+ * Revision 1.41  2004/06/03 08:19:20  strk
+ * yet another Infinite check used: finite() - which checks for NaN,-Inf,+Inf
+ *
  * Revision 1.40  2004/06/03 08:13:11  strk
  * Simplified INFINITY checks by use of isinf()
  *
@@ -331,8 +334,8 @@ bool        parse_points_in_list(char       *str, POINT3D   *points, int32  max_points, bool *is
                        *is3d = TRUE; //found 3 entites (x,y,z)
                }
 
-               if ( isinf(points[numb_found].x) ||
-                       isinf(points[numb_found].y) )
+               if ( ! finite(points[numb_found].x) ||
+                       ! finite(points[numb_found].y) )
                {
                        elog(ERROR, "infinite coordinate in geom");
                        return FALSE;
@@ -401,7 +404,7 @@ bool        parse_points_in_list_exact(char *str, POINT3D   *points, int32  max_points, bo
                                return FALSE; //error occured (nothing parsed)
                        }
                        str = end_of_double;
-                       if ( isinf(points[numb_found].x) )
+                       if ( ! finite(points[numb_found].x) )
                        {
                                elog(ERROR, "infinite coordinate in geom");
                                return FALSE;
@@ -411,7 +414,7 @@ bool        parse_points_in_list_exact(char *str, POINT3D   *points, int32  max_points, bo
                        {
                                return FALSE; //error occured (nothing parsed)
                        }
-                       if ( isinf(points[numb_found].y) )
+                       if ( ! finite(points[numb_found].y) )
                        {
                                elog(ERROR, "infinite coordinate in geom");
                                return FALSE;
@@ -420,7 +423,7 @@ bool        parse_points_in_list_exact(char *str, POINT3D   *points, int32  max_points, bo
                        points[numb_found].z = strtod(str,&end_of_double); //will be zero if error occured
                        if (!(end_of_double == str))
                        {
-                               if ( isinf(points[numb_found].y) )
+                               if ( ! finite(points[numb_found].y) )
                                {
                                        elog(ERROR, "infinite coordinate in geom");
                                        return FALSE;