Last time I checked, 2.6 is not an integer .
Code:
#include <stdio.h>
int main() {
double a = 19683.0, i;
for (i = 0; i < 9; ++i) {
a /= 3;
a *= 2;
printf("%lf\n", a + i);
}
}
Or
Code:
#include <stdio.h>
int main() {
double a = 1.0, i;
for (i = 0; i < 9; ++i) {
a /= 2;
printf("%lf\n", a);
}
a *= 8.0;
a *= 8.0;
a *= 8.0;
printf("%lf\n", a);
}
This works because everything is in base 2.
But of course, these are exceptions, and in general, it's not a good idea to compare floating point numbers with == (or >, <, >=, and <= without a threshold).