c - floating point while loop -
int main() { float x = 50; float y = 1/x; float result = y * x; float test = 41; float z = 1/test; float testres = z * test; while (result == 1) { x--; } printf("%f\n", x); printf("%.6f\n", testres); }
my while loop infinite, never ends, should end @ 41 because when test 41, equals 0.99999404
result
never changes within loop, therefore there no reason believe that, once starts, loop ever end.
Comments
Post a Comment