Urgent [9] RFR (S) : JDK-8039915 NumberFormat.format() does not consider required no. of fraction digits properly

William Price wprice at pros.com
Fri Sep 19 20:02:09 UTC 2014

> Hi Oliver,

First, sorry about mistyping your name, Olivier!

> I copied your patch into my shim locally and ran my test cases and
> still get a couple failures (see output below).  Your patch and my version
> differ in the way and order in which we interpret allDecimalDigits and
> alreadyRounded.

And I should have been more diligent. On second look these are all "very close to a tie"
as described in JDK-7131459, so I now believe my test suite is incorrect.  It matched the
JDK 6-7 behavior but did not account for the JDK8 intended changes for these edge cases.

JDK-7131459 test case:
           0.15 is actually: 0.1499999999999999944488848768742172978818416595458984375
                HALF_UP  --> 0.1                OK
           0.35 is actually: 0.34999999999999997779553950749686919152736663818359375
                HALF_UP  --> 0.3                OK
           0.85 is actually: 0.84999999999999997779553950749686919152736663818359375
                HALF_UP  --> 0.8                OK
           0.95 is actually: 0.9499999999999999555910790149937383830547332763671875
                HALF_UP  --> 0.9                OK

Above tests used Java 1.8.0_20 (Oracle Corporation)
installed at C:\JAVA\latest8\jre

Agent installed: yes
Patch applied  : yes

Overall result : FIXED
William Price | Software Architect | PROS, Inc.

More information about the core-libs-dev mailing list