zero-handling-v2.patch

text/x-patch

Filename: zero-handling-v2.patch
Type: text/x-patch
Part: 0
Message: Re: [PATCH] Improve geometric types

Patch

Format: unified
Series: patch v2
File+
src/backend/utils/adt/geo_ops.c 3 0
diff --git a/src/backend/utils/adt/geo_ops.c b/src/backend/utils/adt/geo_ops.c
index 1fb2ff2603..621b5c33ef 100644
--- a/src/backend/utils/adt/geo_ops.c
+++ b/src/backend/utils/adt/geo_ops.c
@@ -1024,6 +1024,9 @@ line_construct(LINE *result, Point *pt, float8 m)
 		result->A = m;
 		result->B = -1.0;
 		result->C = pt->y - m * pt->x;
+		/* on some platforms, the preceding expression tends to produce -0 */
+		if (result->C == 0.0)
+			result->C = 0.0;
 	}
 }