test/java/util/Formatter/Basic-X.java.template

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,10 +1152,14 @@
         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);
 #end[BigDecimal]
 
 #if[float]
         //---------------------------------------------------------------------
         // %f - float