]> granicus.if.org Git - postgis/commitdiff
Simplified INFINITY checks by use of isinf()
authorSandro Santilli <strk@keybit.net>
Thu, 3 Jun 2004 08:13:11 +0000 (08:13 +0000)
committerSandro Santilli <strk@keybit.net>
Thu, 3 Jun 2004 08:13:11 +0000 (08:13 +0000)
git-svn-id: http://svn.osgeo.org/postgis/trunk@571 b70326c6-7e19-0410-871a-916f4a2858ee

postgis_gist_72.c
postgis_inout.c

index 7bc13da26c46a36d44c2a4ffc5eb6704091e275f..ecf967ca0521ee137c5cdb444b579153786bbe84 100644 (file)
@@ -11,6 +11,9 @@
  *
  **********************************************************************
  * $Log$
+ * Revision 1.16  2004/06/03 08:13:11  strk
+ * Simplified INFINITY checks by use of isinf()
+ *
  * Revision 1.15  2004/06/03 07:58:11  strk
  * Infinite coordinate geoms omitted from index
  *
@@ -169,8 +172,7 @@ Datum ggeometry_compress(PG_FUNCTION_ARGS)
 
                        checkinf = in->bvol.URT.x - in->bvol.URT.y -
                                in->bvol.LLB.x - in->bvol.LLB.y;
-                       if ( isnan(checkinf) || checkinf == INFINITY ||
-                               checkinf == -INFINITY )
+                       if ( isnan(checkinf) || isinf(checkinf) )
                        {
                                //elog(NOTICE, "found infinite geometry");
                                PG_RETURN_POINTER(entry);
@@ -479,18 +481,6 @@ gbox_picksplit(PG_FUNCTION_ARGS)
                        pageunion.low.y = cur->low.y;
        }
 
-       if (
-               pageunion.low.y == -INFINITY ||
-               pageunion.low.y == -INFINITY ||
-               pageunion.high.y == -INFINITY ||
-               pageunion.high.y == INFINITY ||
-               pageunion.low.x == -INFINITY ||
-               pageunion.low.x == -INFINITY ||
-               pageunion.high.x == -INFINITY ||
-               pageunion.high.x == INFINITY 
-       ) elog(NOTICE, "infinite pageunion");
-
-
        nbytes = (maxoff + 2) * sizeof(OffsetNumber);
        listL = (OffsetNumber *) palloc(nbytes);
        listR = (OffsetNumber *) palloc(nbytes);
index 60e98d7a0034917dad0f3aae951c92727a75ccc4..17abbffebf981006ceb2dc8fcc927a6e250ba007 100644 (file)
@@ -11,6 +11,9 @@
  *
  **********************************************************************
  * $Log$
+ * Revision 1.40  2004/06/03 08:13:11  strk
+ * Simplified INFINITY checks by use of isinf()
+ *
  * Revision 1.39  2004/06/03 07:57:29  strk
  * wkt parser throws an error on Infinite coordinates
  *
@@ -328,8 +331,8 @@ bool        parse_points_in_list(char       *str, POINT3D   *points, int32  max_points, bool *is
                        *is3d = TRUE; //found 3 entites (x,y,z)
                }
 
-               if ( abs(points[numb_found].x) == INFINITY ||
-                       abs(points[numb_found].y) == INFINITY )
+               if ( isinf(points[numb_found].x) ||
+                       isinf(points[numb_found].y) )
                {
                        elog(ERROR, "infinite coordinate in geom");
                        return FALSE;
@@ -398,7 +401,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 ( abs(points[numb_found].x) == INFINITY )
+                       if ( isinf(points[numb_found].x) )
                        {
                                elog(ERROR, "infinite coordinate in geom");
                                return FALSE;
@@ -408,7 +411,7 @@ bool        parse_points_in_list_exact(char *str, POINT3D   *points, int32  max_points, bo
                        {
                                return FALSE; //error occured (nothing parsed)
                        }
-                       if ( abs(points[numb_found].y) == INFINITY )
+                       if ( isinf(points[numb_found].y) )
                        {
                                elog(ERROR, "infinite coordinate in geom");
                                return FALSE;
@@ -417,7 +420,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 ( abs(points[numb_found].y) == INFINITY )
+                               if ( isinf(points[numb_found].y) )
                                {
                                        elog(ERROR, "infinite coordinate in geom");
                                        return FALSE;