Is there a Java number formatting library that handles significant digits?
问题 The built in DecimalFormat only allows you to specify number of digits to the right of the decimal place. Because of the limitations of representing numbers as double, number formatting needs to include some level of rounding inside of it. In the general case, that rounding has to be to a number of significant digits (default case is the precision of a double) or else your formatted double will end up showing stuff like 3.5999999 instead of 3.6. The closest solution I could find is using new