DecimalFormat.format() misbehaved on my machine
- From: ps <pausan.lee@xxxxxxxxx>
- Date: Mon, 27 Aug 2007 05:13:38 -0000
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
.
- Follow-Ups:
- Re: DecimalFormat.format() misbehaved on my machine
- From: a24900@xxxxxxxxxxxxxx
- Re: DecimalFormat.format() misbehaved on my machine
- Prev by Date: Re: Console
- Next by Date: Re: DecimalFormat.format() misbehaved on my machine
- Previous by thread: Jpeg encoder exception: Trying to make a thumbail from a jpeg image in a byte[]
- Next by thread: Re: DecimalFormat.format() misbehaved on my machine
- Index(es):
Relevant Pages
|