test/java/util/Formatter/BasicBigDecimal.java

Print this page
rev 7490 : 6469160: (fmt) general (%g) formatting of zero (0.0) with precision 0 or 1 throws ArrayOutOfBoundsException
Summary: For zero value ensure than an unpadded zero character is passed to Formatter.addZeros()
Reviewed-by: TBD
Contributed-by: Brian Burkhalter <brian.burkhalter@oracle.com>

*** 1175,1184 **** --- 1175,1191 ---- test("%.0g", "-1e-05", recip(create(-100000.0))); test("%.0g", "1e+05", create(100000.0)); test("%.3G", "1.00E-05", recip(create(100000.0))); test("%.3G", "-1.00E-05", recip(create(-100000.0))); + test("%.1g", "-0", -0.0); + test("%3.0g", " -0", -0.0); + test("%.1g", "0", 0.0); + test("%3.0g", " 0", 0.0); + test("%.1g", "0", +0.0); + test("%3.0g", " 0", +0.0); + test("%3.0g", "1e-06", 0.000001); test("%3.0g", "1e-05", 0.00001); test("%3.0g", "1e-05", 0.0000099); test("%3.1g", "1e-05", 0.0000099); test("%3.2g", "9.9e-06", 0.0000099);