From 2f8b38266ca4c0fadce4b0a62a436869978a9fa6 Mon Sep 17 00:00:00 2001 From: Stefano Fiorentino Date: Fri, 12 Feb 2016 11:45:56 +0100 Subject: [PATCH] address the double to json accounting for large double (thousands, millions, billions) and avoid "negative mantissa length" --- src/lib_json/json_writer.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/lib_json/json_writer.cpp b/src/lib_json/json_writer.cpp index bce273a..1ac1462 100644 --- a/src/lib_json/json_writer.cpp +++ b/src/lib_json/json_writer.cpp @@ -145,7 +145,14 @@ std::string valueToString(double value, bool useSpecialFloats, unsigned int prec if (length<1) length=1; char formatString[6]; - sprintf(formatString, "%%.%dg", precision-length); + if (length