The falsified result is due to the imperfection in our analytical analysis of the data stream - it does not take into account castings between floating point numbers and integers (for now) and cannot recognize when the floating point number was truncated.
I will try to refine it a bit: the data flow analysis mechanism monitors the values โโof local variables in the methods being analyzed, and when a new value is assigned to a variable, the engine creates a special object that represents the actual value.When you assign one variable to another variable, this object remains the same. For instance:
var x = 5; // the symbol of x is associated with value_0 var y = x; // the symbol of y is associated with value_0 if (x == y) // value_0 is compared with value_0
The values โโwe assign do not contain type information (yet), and we cannot detect (yet) changes in cases such as yours:
var x = 5.5; // the symbol of x is associated with value_0 var y = (int)x; // the symbol of y is associated with value_0 (wrong) if (x == y) // false positive
and we generate false positives, but they are relatively rare because most casts do not generate new values.
Thanks for the feedback, we will consider that in the near future .
source share