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 ?![[ponder] [ponder] [ponder]](/data/assets/smilies/ponder.gif)
Cheers
Alistair![[monkey] [monkey] [monkey]](/data/assets/smilies/monkey.gif)
![[surprise] [surprise] [surprise]](/data/assets/smilies/surprise.gif)
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 ?
![[ponder] [ponder] [ponder]](/data/assets/smilies/ponder.gif)
Cheers
Alistair
![[monkey] [monkey] [monkey]](/data/assets/smilies/monkey.gif)