From 9f10323d583d2a54ebde203ac08fe807bac029ae Mon Sep 17 00:00:00 2001 From: Sandro Santilli Date: Thu, 3 Jun 2004 08:13:11 +0000 Subject: [PATCH] Simplified INFINITY checks by use of isinf() git-svn-id: http://svn.osgeo.org/postgis/trunk@571 b70326c6-7e19-0410-871a-916f4a2858ee --- postgis_gist_72.c | 18 ++++-------------- postgis_inout.c | 13 ++++++++----- 2 files changed, 12 insertions(+), 19 deletions(-) diff --git a/postgis_gist_72.c b/postgis_gist_72.c index 7bc13da26..ecf967ca0 100644 --- a/postgis_gist_72.c +++ b/postgis_gist_72.c @@ -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); diff --git a/postgis_inout.c b/postgis_inout.c index 60e98d7a0..17abbffeb 100644 --- a/postgis_inout.c +++ b/postgis_inout.c @@ -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; -- 2.40.0