changeset 7417:a09a37cff333

6355704: (fmt) %f formatting of BigDecimals is incorrect Reviewed-by: darcy Contributed-by: brian.burkhalter@oracle.com
author mchung
date Thu, 31 Jan 2013 14:29:19 -0800
parents e822b4d50a5b
children d2495b9984fa
files test/java/util/Formatter/Basic-X.java.template test/java/util/Formatter/BasicBigDecimal.java
diffstat 2 files changed, 18 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/test/java/util/Formatter/Basic-X.java.template	Thu Jan 31 14:10:14 2013 -0800
+++ b/test/java/util/Formatter/Basic-X.java.template	Thu Jan 31 14:29:19 2013 -0800
@@ -1103,6 +1103,15 @@
         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]
--- a/test/java/util/Formatter/BasicBigDecimal.java	Thu Jan 31 14:10:14 2013 -0800
+++ b/test/java/util/Formatter/BasicBigDecimal.java	Thu Jan 31 14:29:19 2013 -0800
@@ -1103,6 +1103,15 @@
         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);
+