A DESCRIPTION OF THE PROBLEM :
19 sets of double type values add jvm cash
---------- BEGIN SOURCE ----------
import java.math.BigDecimal;
import java.util.Random;
public class TestDoubleError {
public static void main(String[] args) {
TestDoubleError a = new TestDoubleError();
for (int i = 0; i < 100000; i++) {
String executer = a.executer("test-" + i);
System.out.println(executer);
}
System.out.println("run-end");
}
public String executer(String uuid) {
System.out.println("run" + uuid);
double totalScore = 0;
String realDetailStr = "";
try {
Random rd = new Random();
totalScore = totalScore + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0;
// System.out.println(totalScore);
BigDecimal bigDecimal = new BigDecimal(totalScore).setScale(2, BigDecimal.ROUND_HALF_UP);
totalScore = bigDecimal.doubleValue();
} catch (Exception e) {
}
return totalScore + "," + realDetailStr;
}
}
---------- END SOURCE ----------
19 sets of double type values add jvm cash
---------- BEGIN SOURCE ----------
import java.math.BigDecimal;
import java.util.Random;
public class TestDoubleError {
public static void main(String[] args) {
TestDoubleError a = new TestDoubleError();
for (int i = 0; i < 100000; i++) {
String executer = a.executer("test-" + i);
System.out.println(executer);
}
System.out.println("run-end");
}
public String executer(String uuid) {
System.out.println("run" + uuid);
double totalScore = 0;
String realDetailStr = "";
try {
Random rd = new Random();
totalScore = totalScore + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0;
// System.out.println(totalScore);
BigDecimal bigDecimal = new BigDecimal(totalScore).setScale(2, BigDecimal.ROUND_HALF_UP);
totalScore = bigDecimal.doubleValue();
} catch (Exception e) {
}
return totalScore + "," + realDetailStr;
}
}
---------- END SOURCE ----------
- duplicates
-
JDK-8255058 C1: assert(is_virtual()) failed: type check
-
- Resolved
-