formatSignificant static method
Implementation
static String formatSignificant(double value, int digits) {
double m = value;
if ( m < 0.0 ) {
m = 0.0 - m;
}
int whole = 1;
while (m >= 10.0) {
m = m / 10.0;
whole = whole + 1;
}
int decimals = digits - whole;
if ( decimals < 0 ) {
decimals = 0;
}
return VlJson.formatNumber(value, decimals);
}