AlistairMonkeyFinger
Programmer
Quick general question, just came across a bug in my code becuase of this:
Why is result1 = 0.0 and result2 = 0.8 ? I guess it's something to do with 100 being a double and 100f being a float but i don't quite understand why ?
Cheers
Alistair
Code:
float myf = 80f;
float result1 = myf / 100;
float result2 = myf / 100f;
Why is result1 = 0.0 and result2 = 0.8 ? I guess it's something to do with 100 being a double and 100f being a float but i don't quite understand why ?
Cheers
Alistair