Hi,
I found this description in the API doc:
The number of significant digits in the mantissa is the sum of the
minimum integer and maximum fraction digits, and is unaffected by the
maximum integer digits. For example, 12345 formatted with "##0.##E0"
is "12.3E3".
But when I tried it out, I got different results:
System.out.println(new DecimalFormat("##0.##E0").format(12345)); //
prints 12.345E3
I then took one '#' away from both ends in turn, but still got
unexpected results:
System.out.println(new DecimalFormat("#0.##E0").format(12345)); //
prints 1.234E4
System.out.println(new DecimalFormat("##0.#E0").format(12345)); //
prints 12.34E3
My platform's Win Xp Pro x64 Sp2, and I'm using Java 1.6.
Has anyone else observed the same behavior on different platforms?
Regards,
PS
a24900@googlemail.com - 27 Aug 2007 07:07 GMT
> But when I tried it out, I got different results:
> System.out.println(new DecimalFormat("##0.##E0").format(12345)); //
> prints 12.345E3
It's a four year old bug. And when reported it was already a few years
old:
http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4871921