Floating-point number 4 may not be exact 4, but 3.999999 ..., so when converting to integer, the number after decimal point is truncated, so it is displayed as 3.
It can be like this:
result[I]=(int)(change[I]+0.5);
In this way, decimals are converted into integers according to rounding.