I was recently debugging a program, when I noticed something funny going on with the maths - with some playing, I managed to determine that this was to do with type conversions - trouble is, I can't figure out exactly *why* these 'problems' are there! Could somebody please explain this to me? I'm using VC++ 5.0. Take for example the following situation:
float a=4.7, b=50;
float c=a*b; //c=235, correct.
int d=a*b; //d=234!
int e=(float)4.7*(float)50; //e=235 :S
What is causing this?