In Java/js the decimal type is calculated (accumulate and so on), after the calculation of the results of all the chaos seven or eight in the data, do not know what the reason. But the solution is as follows:
1. Solutions in Java, steps:
A. Convert decimal data into double type:
Double XMZ = 0 D;
BigDecimal zxmz = zx.getmz ();
xmz= zxmz==null?0d:zxmz.doublevalue ();
B. The converted double data is computed and then formatted by DecimalFormat:
Java.text.DecimalFormat df = new Java.text.DecimalFormat ("#.0000");
Df.format (xmz+ (Zxmz==null?0d:zxmz.doublevalue ()));
C. Finally, convert the DecimalFormat formatted data into a double type:
Double.valueof (Df.format (xtj+ (Zxtj==null?0d:zxtj.doublevalue ()));
Java.text.DecimalFormat df = new Java.text.DecimalFormat ("#.0000"); BigDecimal zxmz = ZX.GETMZ ();//ZX.GETMZ () This is the data I get from my program Double xmz = 0D;XMZ = Double.valueof (Df.format (xmz+ (zxmz== Null?0d:zxmz.doublevalue ())));
2. The workaround in JS:
Use substring, intercept
Finally, if you can calculate in the SQL statement, you can calculate it directly in SQL, so as to avoid the above problems
Java Compute Overflow