Today, I found a small problem. I did not talk much about it on the Internet. Here I recorded it to help me solve my own problems.
CodeFragment
1 Float
Unit = Double. valueof (actionutils. getbillingtransformunit (request); // The output unit is 1000.0.
2 Float SVT = (Curvesegment. getendval () + 1 )) / Unit; // Add 0.001
3 Segmentform. setstartvaltemp (string. valueof (SVT ));
The minimum unit for calculation is PCT, And the startvaltemp on the page is Meta, so it must be three decimal places when curvesegment. when getendval () is used to retrieve an integer within 10 million, the value of "add one" is displayed on the page. When the value is 20 million, String. valueof (SVT) is changed to 2 decimal places, thus the added 1 is lost.
Reference my original introduction on mantis"ProgramThe float unit of the numeric type used is 20000 filled in 20000000, converted to 20000001, followed by a value equal to 1000.0 divided by 20000.0. When the value is in the localized string, the precision loss problem occurs (precision problem, float precision is 7-8 bits, in the case of 8 digits, the first digit is 1. When the second digit is used, is the precision behind the second digit lost ?)"
The problem is that the type accuracy is not satisfied, and it is a type selection problem. Solve the problem using the double type
1 Double Unit = Double. valueof (actionutils. getbillingtransformunit (request ));
2 Double SVT = (Curvesegment. getendval () + 1 )) / Unit;
3 Segmentform. setstartvaltemp (string. valueof (SVT ));