[postgis-tickets] r14450 - Fix minimum bounding circle test for 32-bit build

Daniel Baston dbaston at gmail.com
Sun Nov 29 17:16:03 PST 2015


Author: dbaston
Date: 2015-11-29 17:16:03 -0800 (Sun, 29 Nov 2015)
New Revision: 14450

Modified:
   trunk/liblwgeom/cunit/cu_minimum_bounding_circle.c
Log:
Fix minimum bounding circle test for 32-bit build

Modified: trunk/liblwgeom/cunit/cu_minimum_bounding_circle.c
===================================================================
--- trunk/liblwgeom/cunit/cu_minimum_bounding_circle.c	2015-11-29 23:16:30 UTC (rev 14449)
+++ trunk/liblwgeom/cunit/cu_minimum_bounding_circle.c	2015-11-30 01:16:03 UTC (rev 14450)
@@ -27,7 +27,12 @@
 		p.x = p4.x;
 		p.y = p4.y;
 
-		CU_ASSERT_TRUE(distance2d_pt_pt(result->center, &p) <= result->radius);
+		/* We need to store the distance in a variable before the assert so that 
+		 * it is rounded from its 80-bit representation (on x86) down to 64 bits. 
+		 * */
+		double d = distance2d_pt_pt(result->center, &p);
+
+		CU_ASSERT_TRUE(d <= result->radius);
 	}
 
 	lwboundingcircle_destroy(result);



More information about the postgis-tickets mailing list