I have to stop calculation whenever the count is not a fractional number. I have the following code working on GCC. Its not complete a part of code where I got stuck is given below.
double count;
long int ticks = 256;
do
{
count = (500e-6) / (200e-9 * ticks--);
} while (count != (unsigned long) count);
Actually at ticks = 250, count = 10 (on calculator)
then it should stop but when I saw the value of count its not 10 instead it is 9.960159 (By using GDB)
since it's not a whole number it stops at some other value. Now how to solve this problem...