From: Sandro Santilli Date: Thu, 3 Jun 2004 08:19:20 +0000 (+0000) Subject: yet another Infinite check used: finite() - which checks for NaN,-Inf,+Inf X-Git-Tag: pgis_0_9_1~222 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=e881f41d2e0eafc08cd7584a79607630af3de18c;p=postgis yet another Infinite check used: finite() - which checks for NaN,-Inf,+Inf git-svn-id: http://svn.osgeo.org/postgis/trunk@572 b70326c6-7e19-0410-871a-916f4a2858ee --- diff --git a/postgis_gist_72.c b/postgis_gist_72.c index ecf967ca0..e4ee432f4 100644 --- a/postgis_gist_72.c +++ b/postgis_gist_72.c @@ -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); diff --git a/postgis_inout.c b/postgis_inout.c index 17abbffeb..11e9f2a5e 100644 --- a/postgis_inout.c +++ b/postgis_inout.c @@ -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;