try to solve incongruency

This commit is contained in:
Stefano Fiorentino 2016-02-12 12:06:08 +01:00
parent ed3d26311a
commit 341e9c272f

View File

@ -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