You can't use explicit == or != with floats/doubles since the float / double presentation might never actually match the comparision value. This is a fact you need to live with. It can be worked around by adding "precision" to the compare.
Example:
#include <stdio.h>
#include <math.h>
#define FCMP(a,b,p) (fabs((a) - (b)) < p)
int main(void)
{
float aa = 0.0f;
while(!FCMP(aa, 1.0, 0.001))
{
aa = aa + 0.01;
printf("%f\n", aa);
}
return 0;
}
So instead of matching exact value, you are in fact matching some value range.
Making the type double won't help, nor having it work by luck on one particular system make it work on another processor family. Exact matching is a no-no.