test/java/util/Formatter/BasicBigDecimal.java
Print this page
rev 11172 : 8059175: Zero BigDecimal with negative scale prints leading zeroes in String.format
Summary: Correct erroneous appending of zeroes and clean up code logic.
Reviewed-by: TBD
*** 1152,1161 ****
--- 1152,1166 ----
test("%.3f", "1.000", val);
test("%.4f", "0.9996", val);
test("%.5f", "0.99960", val);
test("%.6f", "0.999600", val);
+ val = new BigDecimal(BigInteger.ZERO, 6);
+ test("%.4f", "0.0000", val);
+
+ val = new BigDecimal(BigInteger.ZERO, -6);
+ test("%.4f", "0.0000", val);