address the double to json accounting for large double (thousands, millions, billions) and avoid "negative mantissa length"
This commit is contained in:
parent
a89dec25ad
commit
2f8b38266c
@ -145,7 +145,14 @@ std::string valueToString(double value, bool useSpecialFloats, unsigned int prec
|
||||
if (length<1) length=1;
|
||||
|
||||
char formatString[6];
|
||||
if (length<precision)
|
||||
{
|
||||
sprintf(formatString, "%%.%dg", precision-length);
|
||||
}
|
||||
else
|
||||
{
|
||||
sprintf(formatString, "%%g");
|
||||
}
|
||||
|
||||
// Print into the buffer. We need not request the alternative representation
|
||||
// that always has a decimal point because JSON doesn't distingish the
|
||||
|
Loading…
Reference in New Issue
Block a user