[PATCH] java.math/4428022 Float/Double.toString trailing zeros
Keith Seitz
keiths at redhat.com
Tue Sep 25 19:42:43 UTC 2007
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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: fix-float-double-toString-trailing-zeros.patch
Type: text/x-patch
Size: 1072 bytes
Desc: not available
URL: <http://mail.openjdk.java.net/pipermail/core-libs-dev/attachments/20070925/0bb164da/fix-float-double-toString-trailing-zeros.patch>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: FloatDoubleTrailingZeros.java
Type: text/x-java
Size: 2676 bytes
Desc: not available
URL: <http://mail.openjdk.java.net/pipermail/core-libs-dev/attachments/20070925/0bb164da/FloatDoubleTrailingZeros.java>
More information about the core-libs-dev
mailing list