static formatDouble_significant(double d, int digits) { double d2 = abs(d); while (d2 < 1) { d2 *= 10; ++digits; } ret formatDouble(d, digits); }