03-02-2012, 11:49 AM
na_th_an Wrote:That's called type promotion. Of course, int is not automaticly casted to float 'cause you could lose precision in some cases (as in some integers can't be represented "exactly" in floating point). You have to explicitly cast int to float and float to int. The only automatic "expansion" is between numbers of the same "kind" (integers with integers, reals with reals). This done 'cause it's the best case scenario for calculations. If overflow happens, it should happen at the end of the evaluation, and not in between, when possible.That was the info I was trying to find out. Thanks! :wink: