6355704: (fmt) %f formatting of BigDecimals is incorrect

Reviewed-by: darcy
This commit is contained in:
Brian Burkhalter 2013-01-31 14:29:19 -08:00 committed by Mandy Chung
parent 15cde403c4
commit f7f0768c22
2 changed files with 18 additions and 0 deletions

View File

@ -1103,6 +1103,15 @@ public class Basic$Type$ extends Basic {
test("%.5f", "1.99999", val);
test("%.6f", "1.999990", val);
val = new BigDecimal(0.9996);
test("%.0f", "1", val);
test("%.1f", "1.0", val);
test("%.2f", "1.00", val);
test("%.3f", "1.000", val);
test("%.4f", "0.9996", val);
test("%.5f", "0.99960", val);
test("%.6f", "0.999600", val);
#end[BigDecimal]
#if[float]

View File

@ -1102,6 +1102,15 @@ public class BasicBigDecimal extends Basic {
test("%.4f", "2.0000", val);
test("%.5f", "1.99999", val);
test("%.6f", "1.999990", val);
val = new BigDecimal(0.9996);
test("%.0f", "1", val);
test("%.1f", "1.0", val);
test("%.2f", "1.00", val);
test("%.3f", "1.000", val);
test("%.4f", "0.9996", val);
test("%.5f", "0.99960", val);
test("%.6f", "0.999600", val);