Pls help.. inconsistent integer conversion
Posted on 1998-09-20
I am out of points so pls. try to help ;)
I have a double which I want to typecast to an int
ie. = double ret ;
ret = ..... some calculation (using floor/ceil/pow);
i = (int) ret;
Then problem is that I printed out both ret and i:
ret = 510 BUT i = 509 !!!!!!! inconsistent
why is the convesion inconsistent and HOW do i solve it?
I tried typecaseting it to a long int but it is still the same....
Pls. help.. thanks!!!