Suppose we want to decide the position of point in a float or a double, here is what I do,
Code:
float d;
int count = 0;

while(d!=(int)d)
{
    d *= 10;
    count++;
}
Here count is the position of point. Suppose d = 3.1415, at the end of code, count = 7 and d = 31415002. Basically this is not what I want. I expect at the end, d = 31415 and count = 4. But it is even worse when d is a double. Iencounter an infinite loop. Why? And what is reliable way to do what I expect to do? Thanks.