Use milo dtoa for consistent string representation of numbers

This commit is contained in:
Eric Fischer
2017-08-29 14:44:34 -07:00
parent 3840176d5c
commit f9a007e8c3
32 changed files with 107 additions and 95 deletions
+3 -2
View File
@@ -27,6 +27,7 @@
#include <algorithm>
#include <functional>
#include "jsonpull/jsonpull.h"
#include "milo/dtoa_milo.h"
std::string dequote(std::string s);
@@ -123,10 +124,10 @@ void handle(std::string message, int z, unsigned x, unsigned y, std::map<std::st
aprintf(&value, "%lld", (long long) val.numeric_value.int_value);
type = mvt_double;
} else if (val.type == mvt_double) {
aprintf(&value, "%g", val.numeric_value.double_value);
aprintf(&value, "%s", milo::dtoa_milo(val.numeric_value.double_value).c_str());
type = mvt_double;
} else if (val.type == mvt_float) {
aprintf(&value, "%g", val.numeric_value.float_value);
aprintf(&value, "%s", milo::dtoa_milo(val.numeric_value.float_value).c_str());
type = mvt_double;
} else if (val.type == mvt_bool) {
aprintf(&value, "%s", val.numeric_value.bool_value ? "true" : "false");