From 2e026f9b3b80b8c7dcd413c9ef10b40da1b89482 Mon Sep 17 00:00:00 2001
From: Eric Fischer <enf@pobox.com>
Date: Thu, 27 Oct 2016 14:37:46 -0700
Subject: [PATCH] Use float instead of double in tiles if the value comes out
 the same

---
 tile.cpp | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/tile.cpp b/tile.cpp
index ef95db2..08ce200 100644
--- a/tile.cpp
+++ b/tile.cpp
@@ -146,8 +146,15 @@ mvt_value retrieve_string(long long off, char *stringpool, int *otype) {
 				tv.numeric_value.sint_value = v;
 			}
 		} else {
-			tv.type = mvt_double;
-			tv.numeric_value.double_value = atof(s);
+			double d = atof(s);
+
+			if (d == (float) d) {
+				tv.type = mvt_float;
+				tv.numeric_value.float_value = d;
+			} else {
+				tv.type = mvt_double;
+				tv.numeric_value.double_value = d;
+			}
 		}
 	} else if (type == VT_BOOLEAN) {
 		tv.type = mvt_bool;