July 15th, 2013, 06:38 PM
A question regarding float and double
Suppose we want to decide the position of point in a float or a double, here is what I do,
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. Ｉencounter an infinite loop. Why? And what is reliable way to do what I expect to do? Thanks.
int count = 0;
d *= 10;
Click Here to Expand Forum to Full Width
This is a Codeguru.com survey!