[PATCH] java.math/4428022 Float/Double.toString trailing zeros

Joseph D. Darcy Joe.Darcy at Sun.COM
Sat Oct 6 01:03:34 UTC 2007

Hi Keith.

Thanks for your patch with test.  I'll try to look into incorporating 
this soon (I'm busy with OpenJDK 6).


Keith Seitz wrote:
> Hi,
> I believe the attached patch fixes the trailing zero problem mentioned
> in several bugs (in addition to $SUBJECT), including 4511638, 6575880,
> and 4191279.
> The problem arises because sun.misc.FloatingDecimal.getChars and 
> sun.misc.FloatingDecimal.dtoa disagree about when numbers are 
> represented in E-form and when they are not. As a result, dtoa stuffs 
> one too many numbers (a '0' in this case) into digits[], and getChars 
> blindly returns them to FloatingDecimal.toJavaFormatString.
> I have also attached a jtreg test for this, based on various testcases 
> given in several bug requests.
> Keith

More information about the core-libs-dev mailing list