RFR (XS): 8188245: [Testbug] test/hotspot/jtreg/gc/logging/TestPrintReferences.java can fail
sangheon.kim
sangheon.kim at oracle.com
Fri Oct 6 20:30:41 UTC 2017
Hi all,
Could I have some reviews to fix Java 'double' type rounding issue?
The test is trying to compare time spent at a phase and a sum of each
sub-phases, but the add and subtract operation of 'double' type can
result in rounding issue.
e.g.
double phaseTime=14.7;
double total = 14.8;
double result = phaseTime - total;
// result = -0.10000000000000142 but the test is expecting -0.1 so fails.
My proposal is to use BigDecimal whenever those operations are needed.
CR: https://bugs.openjdk.java.net/browse/JDK-8188245
Webrev: http://cr.openjdk.java.net/~sangheki/8188245/webrev.0/
Testing: JPRT, total of 400 iterations of TestPrintReferences.java
Thanks,
Sangheon
More information about the hotspot-gc-dev
mailing list