To hide the transformation problem, for a simple example, everyone already knows:
Short i=1,j=1;
Short k = i+j;//Compilation error, requires manual transformation.
But i++ is possible. This involves the problem of hiding the transformation.
Today optimization code, the original double with a float, there is no modification, it can correctly compile:
float sum = 0;
float[] location = Point.getlocation ();
if (location = = NULL | | mdescriptor = = NULL) return float.max_value;
for (int i = 0; i < mdescriptor.length; i++) {
Double diff = mdescriptor[i]-location[i];
sum + = Diff*diff;
}
return sum;
The product of the diff of Double can be directly to the sum of float for + = operation.
Asked for a long time, finally found the http://stackoverflow.com/questions/8710619/java-operator.
Of course, the diff of this code is finally changed to float, only in the middle of the process of modification to find this phenomenon.