I wrote below code to convert float variable to integer one:
float myFloat = 45.3F;
int num = (int)(myFloat * 100);
But it returned wrongly 4529 for num variable! And if I change it to:
float myFloat = 23.1F;
int num = (int)(myFloat * 100);
it returns correctly 2310 for num. I solved the problem by using double instead of float. But I want to know what the reason is. Thanks.
