[postgis-tickets] r16296 - Synchronize coordinate output functins.

Darafei komzpa at gmail.com
Sun Jan 14 08:56:14 PST 2018


Author: komzpa
Date: 2018-01-14 08:56:14 -0800 (Sun, 14 Jan 2018)
New Revision: 16296

Modified:
   trunk/doc/html/image_src/generator.c
   trunk/liblwgeom/cunit/cu_measures.c
   trunk/liblwgeom/cunit/cu_out_geojson.c
   trunk/liblwgeom/cunit/cu_out_x3d.c
   trunk/liblwgeom/cunit/cu_ptarray.c
   trunk/liblwgeom/liblwgeom_internal.h
   trunk/liblwgeom/lwout_geojson.c
   trunk/liblwgeom/lwout_gml.c
   trunk/liblwgeom/lwout_svg.c
   trunk/liblwgeom/lwout_wkt.c
   trunk/liblwgeom/lwout_x3d.c
   trunk/liblwgeom/lwprint.c
   trunk/liblwgeom/lwutil.c
   trunk/regress/lwgeom_regress_expected
   trunk/regress/regress_expected
   trunk/regress/regress_sfcgal_expected
   trunk/regress/sfcgal/README
   trunk/regress/sfcgal/regress_expected
   trunk/regress/sfcgal/regress_ogc_expected
   trunk/regress/sfcgal/tickets_expected
   trunk/regress/tickets_expected
Log:
Synchronize coordinate output functins.

Closes #3987
Closes https://github.com/postgis/postgis/pull/190


Modified: trunk/doc/html/image_src/generator.c
===================================================================
--- trunk/doc/html/image_src/generator.c	2018-01-14 16:05:45 UTC (rev 16295)
+++ trunk/doc/html/image_src/generator.c	2018-01-14 16:56:14 UTC (rev 16296)
@@ -35,7 +35,7 @@
 #include <sys/wait.h> /* for WEXITSTATUS */
 
 #include "liblwgeom.h"
-#include "liblwgeom_internal.h" /* for trim_trailing_zeros */
+#include "liblwgeom_internal.h"
 #include "lwgeom_log.h"
 #include "styles.h"
 
@@ -46,7 +46,6 @@
 // Some global styling variables
 char *imageSize = "200x200";
 
-
 int getStyleName(char **styleName, char* line);
 
 static void
@@ -70,8 +69,8 @@
 static size_t
 pointarrayToString(char *output, POINTARRAY *pa)
 {
-	char x[MAX_DIGS_DOUBLE+MAX_DOUBLE_PRECISION+1];
-	char y[MAX_DIGS_DOUBLE+MAX_DOUBLE_PRECISION+1];
+	char x[OUT_DOUBLE_BUFFER_SIZE];
+	char y[OUT_DOUBLE_BUFFER_SIZE];
 	int i;
 	char *ptr = output;
 
@@ -79,10 +78,10 @@
 	{
 		POINT2D pt;
 		getPoint2d_p(pa, i, &pt);
-		sprintf(x, "%f", pt.x);
-		trim_trailing_zeros(x);
-		sprintf(y, "%f", pt.y);
-		trim_trailing_zeros(y);
+
+		lwprint_double(pt.x, 10, x, OUT_DOUBLE_BUFFER_SIZE);
+		lwprint_double(pt.y, 10, y, OUT_DOUBLE_BUFFER_SIZE);
+
 		if ( i ) ptr += sprintf(ptr, " ");
 		ptr += sprintf(ptr, "%s,%s", x, y);
 	}
@@ -102,9 +101,9 @@
 static size_t
 drawPoint(char *output, LWPOINT *lwp, LAYERSTYLE *styles)
 {
-	char x[MAX_DIGS_DOUBLE+MAX_DOUBLE_PRECISION+1];
-	char y1[MAX_DIGS_DOUBLE+MAX_DOUBLE_PRECISION+1];
-	char y2[MAX_DIGS_DOUBLE+MAX_DOUBLE_PRECISION+1];
+	char x[OUT_DOUBLE_BUFFER_SIZE];
+	char y1[OUT_DOUBLE_BUFFER_SIZE];
+	char y2[OUT_DOUBLE_BUFFER_SIZE];
 	char *ptr = output;
 	POINTARRAY *pa = lwp->point;
 	POINT2D p;
@@ -113,12 +112,9 @@
 	LWDEBUGF(4, "%s", "drawPoint called");
 	LWDEBUGF( 4, "point = %s", lwgeom_to_ewkt((LWGEOM*)lwp) );
 
-	sprintf(x, "%f", p.x);
-	trim_trailing_zeros(x);
-	sprintf(y1, "%f", p.y);
-	trim_trailing_zeros(y1);
-	sprintf(y2, "%f", p.y + styles->pointSize);
-	trim_trailing_zeros(y2);
+	lwprint_double(p.x, 10, x, OUT_DOUBLE_BUFFER_SIZE);
+	lwprint_double(p.y, 10, y1, OUT_DOUBLE_BUFFER_SIZE);
+	lwprint_double(p.y + styles->pointSize, 10, y1, OUT_DOUBLE_BUFFER_SIZE);
 
 	ptr += sprintf(ptr, "-fill %s -strokewidth 0 ", styles->pointColor);
 	ptr += sprintf(ptr, "-draw \"circle %s,%s %s,%s", x, y1, x, y2);

Modified: trunk/liblwgeom/cunit/cu_measures.c
===================================================================
--- trunk/liblwgeom/cunit/cu_measures.c	2018-01-14 16:05:45 UTC (rev 16295)
+++ trunk/liblwgeom/cunit/cu_measures.c	2018-01-14 16:56:14 UTC (rev 16296)
@@ -406,7 +406,7 @@
 	LWGEOM *linein = lwgeom_from_wkt("LINESTRING(0 0,10 0)", LW_PARSER_CHECK_NONE);
 	LWGEOM *lineout = lwgeom_segmentize2d(linein, 5);
 	char *strout = lwgeom_to_ewkt(lineout);
-	CU_ASSERT_STRING_EQUAL(strout, "LINESTRING(0 0,5 0,10 0)");
+	ASSERT_STRING_EQUAL(strout, "LINESTRING(0 0,5 0,10 0)");
 	lwfree(strout);
 	lwgeom_free(linein);
 	lwgeom_free(lineout);
@@ -446,7 +446,7 @@
 	/* NOT INTERRUPTED */
 	lineout = lwgeom_segmentize2d(linein, 5);
 	strout = lwgeom_to_ewkt(lineout);
-	CU_ASSERT_STRING_EQUAL(strout, "LINESTRING(20 0,25 0,30 0)");
+	ASSERT_STRING_EQUAL(strout, "LINESTRING(20 0,25 0,30 0)");
 	lwfree(strout);
 	lwgeom_free(linein);
 	lwgeom_free(lineout);
@@ -463,19 +463,19 @@
 	/* ST_Locatealong(ST_GeomFromText('MULTILINESTRING M ((1 2 3, 5 4 5), (50 50 1, 60 60 200))'), 105) */
 	geom = lwgeom_from_wkt("MULTILINESTRING M ((1 2 3, 5 4 5), (50 50 1, 60 60 200))", LW_PARSER_CHECK_NONE);
 	out = lwgeom_locate_along(geom, measure, 0.0);
-	str = lwgeom_to_wkt(out, WKT_ISO, 8, NULL);
+	str = lwgeom_to_wkt(out, WKT_ISO, 6, NULL);
 	lwgeom_free(geom);
 	lwgeom_free(out);
-	CU_ASSERT_STRING_EQUAL("MULTIPOINT M (55.226131 55.226131 105)", str);
+	ASSERT_STRING_EQUAL(str, "MULTIPOINT M (55.226131 55.226131 105)");
 	lwfree(str);
 
 	/* ST_Locatealong(ST_GeomFromText('MULTILINESTRING M ((1 2 3, 5 4 5), (50 50 1, 60 60 200))'), 105) */
 	geom = lwgeom_from_wkt("MULTILINESTRING M ((1 2 3, 3 4 2, 9 4 3), (1 2 3, 5 4 5), (50 50 1, 60 60 200))", LW_PARSER_CHECK_NONE);
 	out = lwgeom_locate_along(geom, measure, 0.0);
-	str = lwgeom_to_wkt(out, WKT_ISO, 8, NULL);
+	str = lwgeom_to_wkt(out, WKT_ISO, 6, NULL);
 	lwgeom_free(geom);
 	lwgeom_free(out);
-	CU_ASSERT_STRING_EQUAL("MULTIPOINT M (55.226131 55.226131 105)", str);
+	ASSERT_STRING_EQUAL(str, "MULTIPOINT M (55.226131 55.226131 105)");
 	lwfree(str);
 }
 
@@ -959,7 +959,9 @@
 	rv = lw_dist2d_ptarray_ptarrayarc(lwline1->points, lwline2->points, &dl);
 	//printf("%s\n", cu_error_msg);
 	CU_ASSERT_EQUAL( rv, LW_FAILURE );
-	CU_ASSERT_STRING_EQUAL("lw_dist2d_ptarray_ptarrayarc called with non-arc input", cu_error_msg);
+	ASSERT_STRING_EQUAL(
+	    cu_error_msg,
+	    "lw_dist2d_ptarray_ptarrayarc called with non-arc input");
 
 	lwline_free(lwline2);
 
@@ -997,10 +999,9 @@
 	lwgeom_free(g1);
 	lwgeom_free(g2);
 	ASSERT_DOUBLE_EQUAL(m, -1.0);
-	CU_ASSERT_STRING_EQUAL(
-	  "Both input geometries must have a measure dimension",
-	  cu_error_msg
-	  );
+	ASSERT_STRING_EQUAL(
+	    cu_error_msg,
+	    "Both input geometries must have a measure dimension");
 
 	/* Invalid input, not linestrings */
 
@@ -1010,10 +1011,8 @@
 	lwgeom_free(g1);
 	lwgeom_free(g2);
 	ASSERT_DOUBLE_EQUAL(m, -1.0);
-	CU_ASSERT_STRING_EQUAL(
-	  "Both input geometries must be linestrings",
-	  cu_error_msg
-	);
+	ASSERT_STRING_EQUAL(cu_error_msg,
+			    "Both input geometries must be linestrings");
 
 	/* Invalid input, too short linestring */
 
@@ -1025,9 +1024,11 @@
 	lwgeom_free(g2);
 	ASSERT_DOUBLE_EQUAL(dist, -77.0); /* not touched */
 	ASSERT_DOUBLE_EQUAL(m, -1.0);
-	CU_ASSERT_STRING_EQUAL(
-	  "Both input lines must have at least 2 points", /* should be accepted ? */
-	  cu_error_msg
+	ASSERT_STRING_EQUAL(
+	    cu_error_msg,
+	    "Both input lines must have at least 2 points" /* should be accepted
+							      ? */
+
 	);
 
 	/* Invalid input, empty linestring */
@@ -1038,9 +1039,9 @@
 	lwgeom_free(g1);
 	lwgeom_free(g2);
 	ASSERT_DOUBLE_EQUAL(m, -1.0);
-	CU_ASSERT_STRING_EQUAL(
-	  "Both input lines must have at least 2 points",
-	  cu_error_msg
+	ASSERT_STRING_EQUAL(cu_error_msg,
+			    "Both input lines must have at least 2 points"
+
 	);
 
 	/* Timeranges do not overlap */

Modified: trunk/liblwgeom/cunit/cu_out_geojson.c
===================================================================
--- trunk/liblwgeom/cunit/cu_out_geojson.c	2018-01-14 16:05:45 UTC (rev 16295)
+++ trunk/liblwgeom/cunit/cu_out_geojson.c	2018-01-14 16:56:14 UTC (rev 16296)
@@ -99,11 +99,11 @@
    *       only zeroes will be returned
    * See http://trac.osgeo.org/postgis/ticket/2051#comment:11
    */
-	do_geojson_test(
-	    "POINT(1E-300 -2E-200)",
-	    "{\"type\":\"Point\",\"coordinates\":[0,-0]}",
-	    NULL, 300, 0);
-
+	do_geojson_test("POINT(1E-300 -2E-200)",
+			"{\"type\":\"Point\",\"coordinates\":[0,0]}",
+			NULL,
+			300,
+			0);
 }
 
 

Modified: trunk/liblwgeom/cunit/cu_out_x3d.c
===================================================================
--- trunk/liblwgeom/cunit/cu_out_x3d.c	2018-01-14 16:05:45 UTC (rev 16295)
+++ trunk/liblwgeom/cunit/cu_out_x3d.c	2018-01-14 16:56:14 UTC (rev 16296)
@@ -77,9 +77,7 @@
 
 	/* huge data */
 	do_x3d3_test(
-	    "POINT(1E300 -105E-153 4E300)'",
-	    "1e+300 -0 4e+300",
-	    NULL, 0, 0);
+	    "POINT(1E300 -105E-153 4E300)'", "1e+300 0 4e+300", NULL, 0, 0);
 }
 
 
@@ -175,8 +173,6 @@
 	    "SRID=4326;POLYGON((15 10 3,13.536 6.464 3,10 5 3,6.464 6.464 3,5 10 3,6.464 13.536 3,10 15 3,13.536 13.536 3,15 10 3))",
 	    "<IndexedFaceSet  convex='false' coordIndex='0 1 2 3 4 5 6 7'><GeoCoordinate geoSystem='\"GD\" \"WE\" \"latitude_first\"' point='10 15 3 6.464 13.536 3 5 10 3 6.464 6.464 3 10 5 3 13.536 6.464 3 15 10 3 13.536 13.536 3 ' /></IndexedFaceSet>",
 	    NULL, 3, 3);
-
-
 }
 
 

Modified: trunk/liblwgeom/cunit/cu_ptarray.c
===================================================================
--- trunk/liblwgeom/cunit/cu_ptarray.c	2018-01-14 16:05:45 UTC (rev 16295)
+++ trunk/liblwgeom/cunit/cu_ptarray.c	2018-01-14 16:56:14 UTC (rev 16296)
@@ -340,8 +340,6 @@
 
 }
 
-
-
 static void test_ptarray_unstroke()
 {
 	LWGEOM *in, *out;
@@ -391,7 +389,11 @@
 	out = lwgeom_unstroke(in);
 	str = lwgeom_to_wkt(out, WKT_ISO, 8, NULL);
 	// printf("%s\n", str);
-	ASSERT_STRING_EQUAL(str, "COMPOUNDCURVE((-3 -3,-1 0),CIRCULARSTRING(-1 0,0.70710678 0.70710678,0 -1),(0 -1,0 -1.5,0 -2),CIRCULARSTRING(0 -2,-0.70710678 -3.7071068,1 -3),(1 -3,5 5))");
+	ASSERT_STRING_EQUAL(
+	    str,
+	    "COMPOUNDCURVE((-3 -3,-1 0),CIRCULARSTRING(-1 0,0.70710678 "
+	    "0.70710678,0 -1),(0 -1,0 -1.5,0 -2),CIRCULARSTRING(0 "
+	    "-2,-0.70710678 -3.70710678,1 -3),(1 -3,5 5))");
 	lwgeom_free(in);
 	lwgeom_free(out);
 	lwfree(str);
@@ -403,7 +405,10 @@
 	out = lwgeom_unstroke(in);
 	str = lwgeom_to_wkt(out, WKT_ISO, 8, NULL);
 	// printf("%s\n", str);
-	ASSERT_STRING_EQUAL(str, "COMPOUNDCURVE(CIRCULARSTRING(-1 0,0.70710678 0.70710678,0 -1),CIRCULARSTRING(0 -1,-0.70710678 -2.7071068,1 -2))");
+	ASSERT_STRING_EQUAL(
+	    str,
+	    "COMPOUNDCURVE(CIRCULARSTRING(-1 0,0.70710678 0.70710678,0 "
+	    "-1),CIRCULARSTRING(0 -1,-0.70710678 -2.70710678,1 -2))");
 	lwgeom_free(in);
 	lwgeom_free(out);
 	lwfree(str);
@@ -720,14 +725,14 @@
   lwfree(wktout);
 
   factor.x = 1; factor.y = 1; factor.z = -2;
-  wkt = "LINESTRING ZM (0 3 -4 3,2 6 -6 0,-4 -9 -0 -1,-6 0 2 -2)";
+  wkt = "LINESTRING ZM (0 3 -4 3,2 6 -6 0,-4 -9 0 -1,-6 0 2 -2)";
   ptarray_scale(pa, &factor);
   wktout = lwgeom_to_text(lwline_as_lwgeom(line));
   ASSERT_STRING_EQUAL(wktout, wkt);
   lwfree(wktout);
 
   factor.x = 1; factor.y = 1; factor.z = 1; factor.m = 2;
-  wkt = "LINESTRING ZM (0 3 -4 6,2 6 -6 0,-4 -9 -0 -2,-6 0 2 -4)";
+  wkt = "LINESTRING ZM (0 3 -4 6,2 6 -6 0,-4 -9 0 -2,-6 0 2 -4)";
   ptarray_scale(pa, &factor);
   wktout = lwgeom_to_text(lwline_as_lwgeom(line));
   ASSERT_STRING_EQUAL(wktout, wkt);

Modified: trunk/liblwgeom/liblwgeom_internal.h
===================================================================
--- trunk/liblwgeom/liblwgeom_internal.h	2018-01-14 16:05:45 UTC (rev 16295)
+++ trunk/liblwgeom/liblwgeom_internal.h	2018-01-14 16:56:14 UTC (rev 16296)
@@ -141,8 +141,9 @@
 #define OUT_SHOW_DIGS_DOUBLE 20
 #define OUT_MAX_DOUBLE_PRECISION 15
 #define OUT_MAX_DIGS_DOUBLE (OUT_SHOW_DIGS_DOUBLE + 2) /* +2 mean add dot and sign */
+#define OUT_DOUBLE_BUFFER_SIZE \
+	OUT_MAX_DIGS_DOUBLE + OUT_MAX_DOUBLE_PRECISION + 1
 
-
 /**
 * Constants for point-in-polygon return values
 */
@@ -480,8 +481,7 @@
 int gbox_centroid(const GBOX* gbox, POINT2D* out);
 
 /* Utilities */
-void trim_trailing_zeros(char *num);
-
+int lwprint_double(double d, int maxdd, char* buf, size_t bufsize);
 extern uint8_t MULTITYPE[NUMTYPES];
 
 extern lwinterrupt_callback *_lwgeom_interrupt_callback;

Modified: trunk/liblwgeom/lwout_geojson.c
===================================================================
--- trunk/liblwgeom/lwout_geojson.c	2018-01-14 16:05:45 UTC (rev 16295)
+++ trunk/liblwgeom/lwout_geojson.c	2018-01-14 16:56:14 UTC (rev 16296)
@@ -676,61 +676,19 @@
 	return (ptr-output);
 }
 
-/*
- * Print an ordinate value using at most the given number of decimal digits
- *
- * The actual number of printed decimal digits may be less than the
- * requested ones if out of significant digits.
- *
- * The function will not write more than maxsize bytes, including the
- * terminating NULL. Returns the number of bytes that would have been
- * written if there was enough space (excluding terminating NULL).
- * So a return of ``bufsize'' or more means that the string was
- * truncated and misses a terminating NULL.
- *
- * TODO: export ?
- *
- */
-static int
-lwprint_double(double d, int maxdd, char *buf, size_t bufsize)
-{
-  double ad = fabs(d);
-  int ndd = ad < 1 ? 0 : floor(log10(ad))+1; /* non-decimal digits */
-  if (fabs(d) < OUT_MAX_DOUBLE)
-  {
-    if ( maxdd > (OUT_MAX_DOUBLE_PRECISION - ndd) )  maxdd -= ndd;
-    return snprintf(buf, bufsize, "%.*f", maxdd, d);
-  }
-  else
-  {
-    return snprintf(buf, bufsize, "%g", d);
-  }
-}
-
-
-
 static size_t
 pointArray_to_geojson(POINTARRAY *pa, char *output, int precision)
 {
 	uint32_t i;
 	char *ptr;
-#define BUFSIZE OUT_MAX_DIGS_DOUBLE+OUT_MAX_DOUBLE_PRECISION
-	char x[BUFSIZE+1];
-	char y[BUFSIZE+1];
-	char z[BUFSIZE+1];
+	char x[OUT_DOUBLE_BUFFER_SIZE];
+	char y[OUT_DOUBLE_BUFFER_SIZE];
+	char z[OUT_DOUBLE_BUFFER_SIZE];
 
 	assert ( precision <= OUT_MAX_DOUBLE_PRECISION );
-
-  /* Ensure a terminating NULL at the end of buffers
-   * so that we don't need to check for truncation
-   * inprint_double */
-  x[BUFSIZE] = '\0';
-  y[BUFSIZE] = '\0';
-  z[BUFSIZE] = '\0';
-
 	ptr = output;
 
-  /* TODO: rewrite this loop to be simpler and possibly quicker */
+	/* TODO: rewrite this loop to be simpler and possibly quicker */
 	if (!FLAGS_GET_Z(pa->flags))
 	{
 		for (i=0; i<pa->npoints; i++)
@@ -738,10 +696,10 @@
 			const POINT2D *pt;
 			pt = getPoint2d_cp(pa, i);
 
-			lwprint_double(pt->x, precision, x, BUFSIZE);
-			trim_trailing_zeros(x);
-			lwprint_double(pt->y, precision, y, BUFSIZE);
-			trim_trailing_zeros(y);
+			lwprint_double(
+			    pt->x, precision, x, OUT_DOUBLE_BUFFER_SIZE);
+			lwprint_double(
+			    pt->y, precision, y, OUT_DOUBLE_BUFFER_SIZE);
 
 			if ( i ) ptr += sprintf(ptr, ",");
 			ptr += sprintf(ptr, "[%s,%s]", x, y);
@@ -754,12 +712,12 @@
 			const POINT3DZ *pt;
 			pt = getPoint3dz_cp(pa, i);
 
-			lwprint_double(pt->x, precision, x, BUFSIZE);
-			trim_trailing_zeros(x);
-			lwprint_double(pt->y, precision, y, BUFSIZE);
-			trim_trailing_zeros(y);
-			lwprint_double(pt->z, precision, z, BUFSIZE);
-			trim_trailing_zeros(z);
+			lwprint_double(
+			    pt->x, precision, x, OUT_DOUBLE_BUFFER_SIZE);
+			lwprint_double(
+			    pt->y, precision, y, OUT_DOUBLE_BUFFER_SIZE);
+			lwprint_double(
+			    pt->z, precision, z, OUT_DOUBLE_BUFFER_SIZE);
 
 			if ( i ) ptr += sprintf(ptr, ",");
 			ptr += sprintf(ptr, "[%s,%s,%s]", x, y, z);
@@ -769,8 +727,6 @@
 	return (ptr-output);
 }
 
-
-
 /**
  * Returns maximum size of rendered pointarray in bytes.
  */

Modified: trunk/liblwgeom/lwout_gml.c
===================================================================
--- trunk/liblwgeom/lwout_gml.c	2018-01-14 16:05:45 UTC (rev 16295)
+++ trunk/liblwgeom/lwout_gml.c	2018-01-14 16:56:14 UTC (rev 16296)
@@ -663,9 +663,9 @@
 {
 	uint32_t i;
 	char *ptr;
-	char x[OUT_MAX_DIGS_DOUBLE+OUT_MAX_DOUBLE_PRECISION+1];
-	char y[OUT_MAX_DIGS_DOUBLE+OUT_MAX_DOUBLE_PRECISION+1];
-	char z[OUT_MAX_DIGS_DOUBLE+OUT_MAX_DOUBLE_PRECISION+1];
+	char x[OUT_DOUBLE_BUFFER_SIZE];
+	char y[OUT_DOUBLE_BUFFER_SIZE];
+	char z[OUT_DOUBLE_BUFFER_SIZE];
 
 	ptr = output;
 
@@ -676,18 +676,11 @@
 			const POINT2D *pt;
 			pt = getPoint2d_cp(pa, i);
 
-			if (fabs(pt->x) < OUT_MAX_DOUBLE)
-				sprintf(x, "%.*f", precision, pt->x);
-			else
-				sprintf(x, "%g", pt->x);
-			trim_trailing_zeros(x);
+			lwprint_double(
+			    pt->x, precision, x, OUT_DOUBLE_BUFFER_SIZE);
+			lwprint_double(
+			    pt->y, precision, y, OUT_DOUBLE_BUFFER_SIZE);
 
-			if (fabs(pt->y) < OUT_MAX_DOUBLE)
-				sprintf(y, "%.*f", precision, pt->y);
-			else
-				sprintf(y, "%g", pt->y);
-			trim_trailing_zeros(y);
-
 			if ( i ) ptr += sprintf(ptr, " ");
 			ptr += sprintf(ptr, "%s,%s", x, y);
 		}
@@ -698,25 +691,13 @@
 		{
 			const POINT3DZ *pt;
 			pt = getPoint3dz_cp(pa, i);
+			lwprint_double(
+			    pt->x, precision, x, OUT_DOUBLE_BUFFER_SIZE);
+			lwprint_double(
+			    pt->y, precision, y, OUT_DOUBLE_BUFFER_SIZE);
+			lwprint_double(
+			    pt->z, precision, z, OUT_DOUBLE_BUFFER_SIZE);
 
-			if (fabs(pt->x) < OUT_MAX_DOUBLE)
-				sprintf(x, "%.*f", precision, pt->x);
-			else
-				sprintf(x, "%g", pt->x);
-			trim_trailing_zeros(x);
-
-			if (fabs(pt->y) < OUT_MAX_DOUBLE)
-				sprintf(y, "%.*f", precision, pt->y);
-			else
-				sprintf(y, "%g", pt->y);
-			trim_trailing_zeros(y);
-
-			if (fabs(pt->z) < OUT_MAX_DOUBLE)
-				sprintf(z, "%.*f", precision, pt->z);
-			else
-				sprintf(z, "%g", pt->z);
-			trim_trailing_zeros(z);
-
 			if ( i ) ptr += sprintf(ptr, " ");
 			ptr += sprintf(ptr, "%s,%s,%s", x, y, z);
 		}
@@ -1910,9 +1891,9 @@
 {
 	uint32_t i;
 	char *ptr;
-	char x[OUT_MAX_DIGS_DOUBLE+OUT_MAX_DOUBLE_PRECISION+1];
-	char y[OUT_MAX_DIGS_DOUBLE+OUT_MAX_DOUBLE_PRECISION+1];
-	char z[OUT_MAX_DIGS_DOUBLE+OUT_MAX_DOUBLE_PRECISION+1];
+	char x[OUT_DOUBLE_BUFFER_SIZE];
+	char y[OUT_DOUBLE_BUFFER_SIZE];
+	char z[OUT_DOUBLE_BUFFER_SIZE];
 
 	ptr = output;
 
@@ -1922,19 +1903,11 @@
 		{
 			const POINT2D *pt;
 			pt = getPoint2d_cp(pa, i);
+			lwprint_double(
+			    pt->x, precision, x, OUT_DOUBLE_BUFFER_SIZE);
+			lwprint_double(
+			    pt->y, precision, y, OUT_DOUBLE_BUFFER_SIZE);
 
-			if (fabs(pt->x) < OUT_MAX_DOUBLE)
-				sprintf(x, "%.*f", precision, pt->x);
-			else
-				sprintf(x, "%g", pt->x);
-			trim_trailing_zeros(x);
-
-			if (fabs(pt->y) < OUT_MAX_DOUBLE)
-				sprintf(y, "%.*f", precision, pt->y);
-			else
-				sprintf(y, "%g", pt->y);
-			trim_trailing_zeros(y);
-
 			if ( i ) ptr += sprintf(ptr, " ");
 			if (IS_DEGREE(opts))
 				ptr += sprintf(ptr, "%s %s", y, x);
@@ -1949,24 +1922,13 @@
 			const POINT3DZ *pt;
 			pt = getPoint3dz_cp(pa, i);
 
-			if (fabs(pt->x) < OUT_MAX_DOUBLE)
-				sprintf(x, "%.*f", precision, pt->x);
-			else
-				sprintf(x, "%g", pt->x);
-			trim_trailing_zeros(x);
+			lwprint_double(
+			    pt->x, precision, x, OUT_DOUBLE_BUFFER_SIZE);
+			lwprint_double(
+			    pt->y, precision, y, OUT_DOUBLE_BUFFER_SIZE);
+			lwprint_double(
+			    pt->z, precision, z, OUT_DOUBLE_BUFFER_SIZE);
 
-			if (fabs(pt->y) < OUT_MAX_DOUBLE)
-				sprintf(y, "%.*f", precision, pt->y);
-			else
-				sprintf(y, "%g", pt->y);
-			trim_trailing_zeros(y);
-
-			if (fabs(pt->z) < OUT_MAX_DOUBLE)
-				sprintf(z, "%.*f", precision, pt->z);
-			else
-				sprintf(z, "%g", pt->z);
-			trim_trailing_zeros(z);
-
 			if ( i ) ptr += sprintf(ptr, " ");
 			if (IS_DEGREE(opts))
 				ptr += sprintf(ptr, "%s %s %s", y, x, z);

Modified: trunk/liblwgeom/lwout_svg.c
===================================================================
--- trunk/liblwgeom/lwout_svg.c	2018-01-14 16:05:45 UTC (rev 16295)
+++ trunk/liblwgeom/lwout_svg.c	2018-01-14 16:56:14 UTC (rev 16296)
@@ -119,25 +119,15 @@
 assvg_point_buf(const LWPOINT *point, char * output, int circle, int precision)
 {
 	char *ptr=output;
-	char x[OUT_MAX_DIGS_DOUBLE+OUT_MAX_DOUBLE_PRECISION+1];
-	char y[OUT_MAX_DIGS_DOUBLE+OUT_MAX_DOUBLE_PRECISION+1];
+	char x[OUT_DOUBLE_BUFFER_SIZE];
+	char y[OUT_DOUBLE_BUFFER_SIZE];
 	POINT2D pt;
 
 	getPoint2d_p(point->point, 0, &pt);
 
-	if (fabs(pt.x) < OUT_MAX_DOUBLE)
-		sprintf(x, "%.*f", precision, pt.x);
-	else
-		sprintf(x, "%g", pt.x);
-	trim_trailing_zeros(x);
+	lwprint_double(pt.x, precision, x, OUT_DOUBLE_BUFFER_SIZE);
+	lwprint_double(-pt.y, precision, y, OUT_DOUBLE_BUFFER_SIZE);
 
-	/* SVG Y axis is reversed, an no need to transform 0 into -0 */
-	if (fabs(pt.y) < OUT_MAX_DOUBLE)
-		sprintf(y, "%.*f", precision, fabs(pt.y) ? pt.y * -1 : pt.y);
-	else
-		sprintf(y, "%g", fabs(pt.y) ? pt.y * -1 : pt.y);
-	trim_trailing_zeros(y);
-
 	if (circle) ptr += sprintf(ptr, "x=\"%s\" y=\"%s\"", x, y);
 	else ptr += sprintf(ptr, "cx=\"%s\" cy=\"%s\"", x, y);
 
@@ -561,8 +551,8 @@
 {
 	int i, end;
 	char *ptr;
-	char sx[OUT_MAX_DIGS_DOUBLE+OUT_MAX_DOUBLE_PRECISION+1];
-	char sy[OUT_MAX_DIGS_DOUBLE+OUT_MAX_DOUBLE_PRECISION+1];
+	char sx[OUT_DOUBLE_BUFFER_SIZE];
+	char sy[OUT_DOUBLE_BUFFER_SIZE];
 	const POINT2D *pt;
 
 	double f = 1.0;
@@ -584,18 +574,8 @@
 	x = round(pt->x*f)/f;
 	y = round(pt->y*f)/f;
 
-	if (fabs(x) < OUT_MAX_DOUBLE)
-		sprintf(sx, "%.*f", precision, x);
-	else
-		sprintf(sx, "%g", x);
-	trim_trailing_zeros(sx);
-
-	if (fabs(y) < OUT_MAX_DOUBLE)
-		sprintf(sy, "%.*f", precision, fabs(y) ? y * -1 : y);
-	else
-		sprintf(sy, "%g", fabs(y) ? y * -1 : y);
-	trim_trailing_zeros(sy);
-
+	lwprint_double(x, precision, sx, OUT_DOUBLE_BUFFER_SIZE);
+	lwprint_double(-y, precision, sy, OUT_DOUBLE_BUFFER_SIZE);
 	ptr += sprintf(ptr,"%s %s l", sx, sy);
 
 	/* accum */
@@ -614,21 +594,9 @@
 		dx = x - accum_x;
 		dy = y - accum_y;
 
-		if (fabs(dx) < OUT_MAX_DOUBLE)
-			sprintf(sx, "%.*f", precision, dx);
-		else
-			sprintf(sx, "%g", dx);
-		trim_trailing_zeros(sx);
+		lwprint_double(dx, precision, sx, OUT_DOUBLE_BUFFER_SIZE);
+		lwprint_double(-dy, precision, sy, OUT_DOUBLE_BUFFER_SIZE);
 
-		/* SVG Y axis is reversed, an no need to transform 0 into -0 */
-		if (fabs(dy) < OUT_MAX_DOUBLE)
-			sprintf(sy, "%.*f", precision,
-			        fabs(dy) ? dy * -1: dy);
-		else
-			sprintf(sy, "%g",
-			        fabs(dy) ? dy * -1: dy);
-		trim_trailing_zeros(sy);
-
 		accum_x += dx;
 		accum_y += dy;
 
@@ -647,8 +615,8 @@
 {
 	int i, end;
 	char *ptr;
-	char x[OUT_MAX_DIGS_DOUBLE+OUT_MAX_DOUBLE_PRECISION+1];
-	char y[OUT_MAX_DIGS_DOUBLE+OUT_MAX_DOUBLE_PRECISION+1];
+	char x[OUT_DOUBLE_BUFFER_SIZE];
+	char y[OUT_DOUBLE_BUFFER_SIZE];
 	POINT2D pt;
 
 	ptr = output;
@@ -660,19 +628,9 @@
 	{
 		getPoint2d_p(pa, i, &pt);
 
-		if (fabs(pt.x) < OUT_MAX_DOUBLE)
-			sprintf(x, "%.*f", precision, pt.x);
-		else
-			sprintf(x, "%g", pt.x);
-		trim_trailing_zeros(x);
+		lwprint_double(pt.x, precision, x, OUT_DOUBLE_BUFFER_SIZE);
+		lwprint_double(-pt.y, precision, y, OUT_DOUBLE_BUFFER_SIZE);
 
-		/* SVG Y axis is reversed, an no need to transform 0 into -0 */
-		if (fabs(pt.y) < OUT_MAX_DOUBLE)
-			sprintf(y, "%.*f", precision, fabs(pt.y) ? pt.y * -1:pt.y);
-		else
-			sprintf(y, "%g", fabs(pt.y) ? pt.y * -1:pt.y);
-		trim_trailing_zeros(y);
-
 		if (i == 1) ptr += sprintf(ptr, " L ");
 		else if (i) ptr += sprintf(ptr, " ");
 		ptr += sprintf(ptr,"%s %s", x, y);

Modified: trunk/liblwgeom/lwout_wkt.c
===================================================================
--- trunk/liblwgeom/lwout_wkt.c	2018-01-14 16:05:45 UTC (rev 16295)
+++ trunk/liblwgeom/lwout_wkt.c	2018-01-14 16:56:14 UTC (rev 16296)
@@ -85,6 +85,7 @@
 	/* OGC only includes X/Y */
 	uint32_t dimensions = 2;
 	uint32_t i, j;
+	char coord[OUT_DOUBLE_BUFFER_SIZE];
 
 	/* ISO and extended formats include all dimensions */
 	if ( variant & ( WKT_ISO | WKT_EXTENDED ) )
@@ -108,7 +109,11 @@
 			/* Spaces before every ordinate but the first */
 			if ( j > 0 )
 				stringbuffer_append(sb, " ");
-			stringbuffer_aprintf(sb, "%.*g", precision, dbl_ptr[j]);
+			lwprint_double(dbl_ptr[j],
+				       precision,
+				       coord,
+				       OUT_DOUBLE_BUFFER_SIZE);
+			stringbuffer_append(sb, coord);
 		}
 	}
 
@@ -657,15 +662,16 @@
 }
 
 /**
-* WKT emitter function. Allocates a new *char and fills it with the WKT
-* representation. If size_out is not NULL, it will be set to the size of the
-* allocated *char.
-*
-* @param variant Bitmasked value, accepts one of WKT_ISO, WKT_SFSQL, WKT_EXTENDED.
-* @param precision Number of significant digits in the output doubles.
-* @param size_out If supplied, will return the size of the returned string,
-* including the null terminator.
-*/
+ * WKT emitter function. Allocates a new *char and fills it with the WKT
+ * representation. If size_out is not NULL, it will be set to the size of the
+ * allocated *char.
+ *
+ * @param variant Bitmasked value, accepts one of WKT_ISO, WKT_SFSQL,
+ * WKT_EXTENDED.
+ * @param precision Maximal number of digits after comma in the output doubles.
+ * @param size_out If supplied, will return the size of the returned string,
+ * including the null terminator.
+ */
 char* lwgeom_to_wkt(const LWGEOM *geom, uint8_t variant, int precision, size_t *size_out)
 {
 	stringbuffer_t *sb;

Modified: trunk/liblwgeom/lwout_x3d.c
===================================================================
--- trunk/liblwgeom/lwout_x3d.c	2018-01-14 16:05:45 UTC (rev 16295)
+++ trunk/liblwgeom/lwout_x3d.c	2018-01-14 16:56:14 UTC (rev 16296)
@@ -498,9 +498,9 @@
 ptarray_to_x3d3_sb(POINTARRAY *pa, int precision, int opts, int is_closed, stringbuffer_t *sb )
 {
 	uint32_t i;
-	char x[OUT_MAX_DIGS_DOUBLE+OUT_MAX_DOUBLE_PRECISION+1];
-	char y[OUT_MAX_DIGS_DOUBLE+OUT_MAX_DOUBLE_PRECISION+1];
-	char z[OUT_MAX_DIGS_DOUBLE+OUT_MAX_DOUBLE_PRECISION+1];
+	char x[OUT_DOUBLE_BUFFER_SIZE];
+	char y[OUT_DOUBLE_BUFFER_SIZE];
+	char z[OUT_DOUBLE_BUFFER_SIZE];
 
 	if ( ! FLAGS_GET_Z(pa->flags) )
 	{
@@ -512,18 +512,11 @@
 				POINT2D pt;
 				getPoint2d_p(pa, i, &pt);
 
-				if (fabs(pt.x) < OUT_MAX_DOUBLE)
-					sprintf(x, "%.*f", precision, pt.x);
-				else
-					sprintf(x, "%g", pt.x);
-				trim_trailing_zeros(x);
+				lwprint_double(
+				    pt.x, precision, x, OUT_DOUBLE_BUFFER_SIZE);
+				lwprint_double(
+				    pt.y, precision, y, OUT_DOUBLE_BUFFER_SIZE);
 
-				if (fabs(pt.y) < OUT_MAX_DOUBLE)
-					sprintf(y, "%.*f", precision, pt.y);
-				else
-					sprintf(y, "%g", pt.y);
-				trim_trailing_zeros(y);
-
 				if ( i ) stringbuffer_append(sb," ");
 
 				if ( ( opts & LW_X3D_FLIP_XY) )
@@ -543,24 +536,13 @@
 				POINT4D pt;
 				getPoint4d_p(pa, i, &pt);
 
-				if (fabs(pt.x) < OUT_MAX_DOUBLE)
-					sprintf(x, "%.*f", precision, pt.x);
-				else
-					sprintf(x, "%g", pt.x);
-				trim_trailing_zeros(x);
+				lwprint_double(
+				    pt.x, precision, x, OUT_DOUBLE_BUFFER_SIZE);
+				lwprint_double(
+				    pt.y, precision, y, OUT_DOUBLE_BUFFER_SIZE);
+				lwprint_double(
+				    pt.z, precision, z, OUT_DOUBLE_BUFFER_SIZE);
 
-				if (fabs(pt.y) < OUT_MAX_DOUBLE)
-					sprintf(y, "%.*f", precision, pt.y);
-				else
-					sprintf(y, "%g", pt.y);
-				trim_trailing_zeros(y);
-
-				if (fabs(pt.z) < OUT_MAX_DOUBLE)
-					sprintf(z, "%.*f", precision, pt.z);
-				else
-					sprintf(z, "%g", pt.z);
-				trim_trailing_zeros(z);
-
 				if ( i ) stringbuffer_append(sb," ");
 
 				if ( ( opts & LW_X3D_FLIP_XY) )

Modified: trunk/liblwgeom/lwprint.c
===================================================================
--- trunk/liblwgeom/lwprint.c	2018-01-14 16:05:45 UTC (rev 16295)
+++ trunk/liblwgeom/lwprint.c	2018-01-14 16:56:14 UTC (rev 16296)
@@ -435,3 +435,76 @@
 	p = getPoint2d_cp(pt->point, 0);
 	return lwdoubles_to_latlon(p->y, p->x, format);
 }
+
+/*
+ * Removes trailing zeros and dot for a %f formatted number.
+ * Modifies input.
+ */
+static void
+trim_trailing_zeros(char* str)
+{
+	char *ptr, *totrim = NULL;
+	int len;
+	int i;
+
+	LWDEBUGF(3, "input: %s", str);
+
+	ptr = strchr(str, '.');
+	if (!ptr) return; /* no dot, no decimal digits */
+
+	LWDEBUGF(3, "ptr: %s", ptr);
+
+	len = strlen(ptr);
+	for (i = len - 1; i; i--)
+	{
+		if (ptr[i] != '0') break;
+		totrim = &ptr[i];
+	}
+	if (totrim)
+	{
+		if (ptr == totrim - 1)
+			*ptr = '\0';
+		else
+			*totrim = '\0';
+	}
+
+	LWDEBUGF(3, "output: %s", str);
+}
+
+/*
+ * Print an ordinate value using at most the given number of decimal digits
+ *
+ * The actual number of printed decimal digits may be less than the
+ * requested ones if out of significant digits.
+ *
+ * The function will not write more than maxsize bytes, including the
+ * terminating NULL. Returns the number of bytes that would have been
+ * written if there was enough space (excluding terminating NULL).
+ * So a return of ``bufsize'' or more means that the string was
+ * truncated and misses a terminating NULL.
+ *
+ */
+int
+lwprint_double(double d, int maxdd, char* buf, size_t bufsize)
+{
+	double ad = fabs(d);
+	int ndd = ad < 1 ? 0 : floor(log10(ad)) + 1; /* non-decimal digits */
+	int length = 0;
+	if (ad <= FP_TOLERANCE)
+	{
+		d = 0;
+		ad = 0;
+	}
+	if (ad < OUT_MAX_DOUBLE)
+	{
+		if (maxdd > (OUT_MAX_DOUBLE_PRECISION - ndd)) maxdd -= ndd;
+		length = snprintf(buf, bufsize, "%.*f", maxdd, d);
+	}
+	else
+	{
+		length = snprintf(buf, bufsize, "%g", d);
+	}
+	assert(length < bufsize);
+	trim_trailing_zeros(buf);
+	return length;
+}
\ No newline at end of file

Modified: trunk/liblwgeom/lwutil.c
===================================================================
--- trunk/liblwgeom/lwutil.c	2018-01-14 16:05:45 UTC (rev 16295)
+++ trunk/liblwgeom/lwutil.c	2018-01-14 16:56:14 UTC (rev 16296)
@@ -247,39 +247,6 @@
 }
 
 /*
- * Removes trailing zeros and dot for a %f formatted number.
- * Modifies input.
- */
-void
-trim_trailing_zeros(char *str)
-{
-	char *ptr, *totrim=NULL;
-	int len;
-	int i;
-
-	LWDEBUGF(3, "input: %s", str);
-
-	ptr = strchr(str, '.');
-	if ( ! ptr ) return; /* no dot, no decimal digits */
-
-	LWDEBUGF(3, "ptr: %s", ptr);
-
-	len = strlen(ptr);
-	for (i=len-1; i; i--)
-	{
-		if ( ptr[i] != '0' ) break;
-		totrim=&ptr[i];
-	}
-	if ( totrim )
-	{
-		if ( ptr == totrim-1 ) *ptr = '\0';
-		else *totrim = '\0';
-	}
-
-	LWDEBUGF(3, "output: %s", str);
-}
-
-/*
  * Returns a new string which contains a maximum of maxlength characters starting
  * from startpos and finishing at endpos (0-based indexing). If the string is
  * truncated then the first or last characters are replaced by "..." as

Modified: trunk/regress/lwgeom_regress_expected
===================================================================
--- trunk/regress/lwgeom_regress_expected	2018-01-14 16:05:45 UTC (rev 16295)
+++ trunk/regress/lwgeom_regress_expected	2018-01-14 16:56:14 UTC (rev 16296)
@@ -15,9 +15,9 @@
 #3069|BOX(0 0,1 1)
 #3069|BOX(1 1,1 1)
 #3069|BOX(0 0,1 1)
-BoundingDiagonal1|SRID=4326;LINESTRING(999999986991104 999999986991104,1.00000005409997e+15 1.00000005409997e+15)
+BoundingDiagonal1|SRID=4326;LINESTRING(999999986991104 999999986991104,1e+15 1e+15)
 BoundingDiagonal2|SRID=4326;LINESTRING(1e+15 1e+15,1e+15 1e+15)
-BoundingDiagonal3|SRID=4326;LINESTRING(999999986991104 999999986991104,1.00000005409997e+15 1.00000005409997e+15)
+BoundingDiagonal3|SRID=4326;LINESTRING(999999986991104 999999986991104,1e+15 1e+15)
 BoundingDiagonal4|SRID=3857;LINESTRING(-1 -2 -8 2,1 2 3 9)
 BoundingDiagonal5|SRID=3857;LINESTRINGM(4 4 0,5 4 1)
 BoundingDiagonal6|SRID=3857;LINESTRINGM EMPTY

Modified: trunk/regress/regress_expected
===================================================================
--- trunk/regress/regress_expected	2018-01-14 16:05:45 UTC (rev 16295)
+++ trunk/regress/regress_expected	2018-01-14 16:56:14 UTC (rev 16296)
@@ -45,7 +45,7 @@
 45|GEOMETRYCOLLECTION(MULTILINESTRING((0 0 0,1 1 0,2 2 0,3 3 0,4 4 0)),POINT(1 2 3))
 46|GEOMETRYCOLLECTION(POINT(1 2 3),MULTIPOLYGON(((0 0 0,10 0 0,10 10 0,0 10 0,0 0 0)),((0 0 0,10 0 0,10 10 0,0 10 0,0 0 0),(5 5 0,7 5 0,7 7 0,5 7 0,5 5 0)),((0 0 1,10 0 1,10 10 1,0 10 1,0 0 1),(5 5 1,7 5 1,7 7 1,5 7 1,5 5 1),(1 1 1,2 1 1,2 2 1,1 2 1,1 1 1))))
 47|GEOMETRYCOLLECTION(MULTIPOLYGON(((0 0 0,10 0 0,10 10 0,0 10 0,0 0 0)),((0 0 0,10 0 0,10 10 0,0 10 0,0 0 0),(5 5 0,7 5 0,7 7 0,5 7 0,5 5 0)),((0 0 1,10 0 1,10 10 1,0 10 1,0 0 1),(5 5 1,7 5 1,7 7 1,5 7 1,5 5 1),(1 1 1,2 1 1,2 2 1,1 2 1,1 1 1))),MULTILINESTRING((0 0 0,1 1 0,2 2 0,3 3 0,4 4 0),(0 0 0,1 1 0,2 2 0,3 3 0,4 4 0),(1 2 3,4 5 6,7 8 9,10 11 12,13 14 15)),MULTIPOINT(1 2 3,5 6 7,8 9 10,11 12 13))
-48|MULTIPOINT(-1 -2 -3,5.4 6.6 7.77,-5.4 -6.6 -7.77,1000000 1e-6 -1000000,-1.3e-6 -1.4e-5 0)
+48|MULTIPOINT(-1 -2 -3,5.4 6.6 7.77,-5.4 -6.6 -7.77,1000000 0.000001 -1000000,-0.0000013 -0.000014 0)
 49|GEOMETRYCOLLECTION(GEOMETRYCOLLECTION(POINT(1 1)))
 ERROR:  parse error - invalid geometry at character 14
 ERROR:  parse error - invalid geometry at character 14

Modified: trunk/regress/regress_sfcgal_expected
===================================================================
--- trunk/regress/regress_sfcgal_expected	2018-01-14 16:05:45 UTC (rev 16295)
+++ trunk/regress/regress_sfcgal_expected	2018-01-14 16:56:14 UTC (rev 16296)
@@ -10,6 +10,6 @@
 ST_MinkowskiSum|MULTIPOLYGON(((0 0,1 0,5 0,5 1,4 1,0 1,0 0)))
 ST_StraightSkeleton|MULTILINESTRING((1 1,1.5 1.5),(2 1,1.5 1.5),(2 2,1.5 1.5),(1 2,1.5 1.5))
 intersection_geos|POINT(0 0)
-intersection_sfcgal|POINT(-0 -0)
+intersection_sfcgal|POINT(0 0)
 ERROR:  Can't find foo geometry backend
 ERROR:  Can't find  geometry backend

Modified: trunk/regress/sfcgal/README
===================================================================
--- trunk/regress/sfcgal/README	2018-01-14 16:05:45 UTC (rev 16295)
+++ trunk/regress/sfcgal/README	2018-01-14 16:56:14 UTC (rev 16296)
@@ -41,19 +41,7 @@
    which .. also make sense
 
 
-
 ==
-sfcgal/regress_ogc
-==
-
-65.OBT: intersection|POINT(-0 -0)
-65.EXP: intersection|POINT(0 0)
-
-=> No comment, except that the test itself could be sligthly rewrited
-
-
-
-==
 sfcgal/empty
 ==
 

Modified: trunk/regress/sfcgal/regress_expected
===================================================================
--- trunk/regress/sfcgal/regress_expected	2018-01-14 16:05:45 UTC (rev 16295)
+++ trunk/regress/sfcgal/regress_expected	2018-01-14 16:56:14 UTC (rev 16296)
@@ -45,7 +45,7 @@
 45|GEOMETRYCOLLECTION(MULTILINESTRING((0 0 0,1 1 0,2 2 0,3 3 0,4 4 0)),POINT(1 2 3))
 46|GEOMETRYCOLLECTION(POINT(1 2 3),MULTIPOLYGON(((0 0 0,10 0 0,10 10 0,0 10 0,0 0 0)),((0 0 0,10 0 0,10 10 0,0 10 0,0 0 0),(5 5 0,7 5 0,7 7 0,5 7 0,5 5 0)),((0 0 1,10 0 1,10 10 1,0 10 1,0 0 1),(5 5 1,7 5 1,7 7 1,5 7 1,5 5 1),(1 1 1,2 1 1,2 2 1,1 2 1,1 1 1))))
 47|GEOMETRYCOLLECTION(MULTIPOLYGON(((0 0 0,10 0 0,10 10 0,0 10 0,0 0 0)),((0 0 0,10 0 0,10 10 0,0 10 0,0 0 0),(5 5 0,7 5 0,7 7 0,5 7 0,5 5 0)),((0 0 1,10 0 1,10 10 1,0 10 1,0 0 1),(5 5 1,7 5 1,7 7 1,5 7 1,5 5 1),(1 1 1,2 1 1,2 2 1,1 2 1,1 1 1))),MULTILINESTRING((0 0 0,1 1 0,2 2 0,3 3 0,4 4 0),(0 0 0,1 1 0,2 2 0,3 3 0,4 4 0),(1 2 3,4 5 6,7 8 9,10 11 12,13 14 15)),MULTIPOINT(1 2 3,5 6 7,8 9 10,11 12 13))
-48|MULTIPOINT(-1 -2 -3,5.4 6.6 7.77,-5.4 -6.6 -7.77,1000000 1e-6 -1000000,-1.3e-6 -1.4e-5 0)
+48|MULTIPOINT(-1 -2 -3,5.4 6.6 7.77,-5.4 -6.6 -7.77,1000000 0.000001 -1000000,-0.0000013 -0.000014 0)
 49|GEOMETRYCOLLECTION(GEOMETRYCOLLECTION(POINT(1 1)))
 ERROR:  parse error - invalid geometry at character 14
 ERROR:  parse error - invalid geometry at character 14

Modified: trunk/regress/sfcgal/regress_ogc_expected
===================================================================
--- trunk/regress/sfcgal/regress_ogc_expected	2018-01-14 16:05:45 UTC (rev 16295)
+++ trunk/regress/sfcgal/regress_ogc_expected	2018-01-14 16:56:14 UTC (rev 16296)
@@ -88,7 +88,7 @@
 NOTICE:  Self-intersection
 isvalid|f
 isvalid|t
-intersection|POINT(-0 -0)
+intersection|POINT(0 0)
 difference|MULTILINESTRING((0 -2,0 -10),(0 10,0 2))
 boundary|MULTILINESTRING((0 0,0 10,10 10,10 0,0 0),(2 2,2 4,4 4,4 2,2 2))
 symdifference|GEOMETRYCOLLECTION(LINESTRING(2 2,4 4),LINESTRING(10 10,20 20),POLYGON((0 0,0 10,10 10,10 0,0 0),(4 4,2 4,2 2,4 2,4 4)))

Modified: trunk/regress/sfcgal/tickets_expected
===================================================================
--- trunk/regress/sfcgal/tickets_expected	2018-01-14 16:05:45 UTC (rev 16295)
+++ trunk/regress/sfcgal/tickets_expected	2018-01-14 16:56:14 UTC (rev 16296)
@@ -32,7 +32,7 @@
 #157|ST_Polygon|POLYGON
 #157|ST_CurvePolygon|CURVEPOLYGON
 #157|ST_CircularString|CIRCULARSTRING
-#168|3|MULTIPOLYGON ZM (((4275341.96977851 259186.966993061 1323.76295828331 -1.79769313486232e+308,4275341.96977851 259186.966993061 1323.76295828331 -1.79769313486232e+308,4275341.96977851 259186.966993061 1323.76295828331 -1.79769313486232e+308)))|IllegalArgumentException: Invalid number of points in LinearRing found 3 - must be 0 or >= 4
+#168|3|MULTIPOLYGON ZM (((4275341.96977851 259186.966993061 1323.76295828331 -1.79769e+308,4275341.96977851 259186.966993061 1323.76295828331 -1.79769e+308,4275341.96977851 259186.966993061 1323.76295828331 -1.79769e+308)))|IllegalArgumentException: Invalid number of points in LinearRing found 3 - must be 0 or >= 4
 #175|SRID=26915;POINT(482020 4984378)
 #178a|0
 #178b|5

Modified: trunk/regress/tickets_expected
===================================================================
--- trunk/regress/tickets_expected	2018-01-14 16:05:45 UTC (rev 16295)
+++ trunk/regress/tickets_expected	2018-01-14 16:56:14 UTC (rev 16296)
@@ -32,7 +32,7 @@
 #157|ST_Polygon|POLYGON
 #157|ST_CurvePolygon|CURVEPOLYGON
 #157|ST_CircularString|CIRCULARSTRING
-#168|3|MULTIPOLYGON ZM (((4275341.96977851 259186.966993061 1323.76295828331 -1.79769313486232e+308,4275341.96977851 259186.966993061 1323.76295828331 -1.79769313486232e+308,4275341.96977851 259186.966993061 1323.76295828331 -1.79769313486232e+308)))|IllegalArgumentException: Invalid number of points in LinearRing found 3 - must be 0 or >= 4
+#168|3|MULTIPOLYGON ZM (((4275341.96977851 259186.966993061 1323.76295828331 -1.79769e+308,4275341.96977851 259186.966993061 1323.76295828331 -1.79769e+308,4275341.96977851 259186.966993061 1323.76295828331 -1.79769e+308)))|IllegalArgumentException: Invalid number of points in LinearRing found 3 - must be 0 or >= 4
 #175|SRID=26915;POINT(482020 4984378)
 #178a|0
 #178b|5
@@ -307,7 +307,7 @@
 #3709|t
 #3774|t
 #1014a|POINT(0 0)
-#1014a|POINT(-0 0)
+#1014a|POINT(0 0)
 #1014b|POINT(0 1)
 #1014c|1|POINT(0 1)
 #1014c|2|POINT(1 2)



More information about the postgis-tickets mailing list