mirror of
https://github.com/open-source-parsers/jsoncpp.git
synced 2025-07-04 02:37:10 +02:00
try to solve incongruency
This commit is contained in:
parent
ed3d26311a
commit
341e9c272f
@ -143,16 +143,10 @@ std::string valueToString(double value, bool useSpecialFloats, unsigned int prec
|
|||||||
|
|
||||||
unsigned int length = (value==0.0)?(unsigned int)1:(unsigned int)(std::floor(std::log10(std::abs(value)))+1);
|
unsigned int length = (value==0.0)?(unsigned int)1:(unsigned int)(std::floor(std::log10(std::abs(value)))+1);
|
||||||
if (length<1) length=1;
|
if (length<1) length=1;
|
||||||
|
if (lenght>precision-1) length = precision-1;
|
||||||
|
|
||||||
char formatString[6];
|
char formatString[6];
|
||||||
if (length<precision)
|
|
||||||
{
|
|
||||||
sprintf(formatString, "%%.%dg", precision-length);
|
sprintf(formatString, "%%.%dg", precision-length);
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
sprintf(formatString, "%%g");
|
|
||||||
}
|
|
||||||
|
|
||||||
// Print into the buffer. We need not request the alternative representation
|
// Print into the buffer. We need not request the alternative representation
|
||||||
// that always has a decimal point because JSON doesn't distingish the
|
// that always has a decimal point because JSON doesn't distingish the
|
||||||
|
Loading…
x
Reference in New Issue
Block a user