# HG changeset patch # User Chris Cannam # Date 1386165627 0 # Node ID b81f21f2c4c3d1cb115e278a098ac4869fb7377f # Parent 084f65094203bbbae7e22630a04cd617b149088f Not quite so many digits diff -r 084f65094203 -r b81f21f2c4c3 layer/LogNumericalScale.cpp --- a/layer/LogNumericalScale.cpp Wed Dec 04 13:39:41 2013 +0000 +++ b/layer/LogNumericalScale.cpp Wed Dec 04 14:00:27 2013 +0000 @@ -64,6 +64,7 @@ int prec = trunc(log10f(minDispInc)); if (prec < 0) dp = -prec; round = powf(10.f, prec); + if (dp > 4) dp = 4; #ifdef DEBUG_TIME_VALUE_LAYER cerr << "round = " << round << ", prec = " << prec << ", dp = " << dp << endl; #endif @@ -97,11 +98,13 @@ continue; } - double dv = dispval; - int digits = trunc(log10f(dv)); + int digits = trunc(log10f(dispval)); int sf = dp + (digits > 0 ? digits : 0); if (sf < 4) sf = 4; - sprintf(buffer, "%.*g", sf, dv); +#ifdef DEBUG_TIME_VALUE_LAYER + cerr << "sf = " << sf << endl; +#endif + sprintf(buffer, "%.*g", sf, dispval); QString label = QString(buffer);