I can’t reproduce this with a simple program, but somewhere in my program I have something like:
float e = f(...);
if (e > 0.0f) {
...
printf("%f", e) shows that e is 0.000000, yet e > 0.0f is true… So is e > 0 and e > 0.0. What am I missing?
The problem is that the floating point value is greater than 0, but less than the precision that printf uses to print floating point numbers with
%f. You can use%eor%gfor better results as illustrated with the following program.You will need to compile this with the maths library. For gcc use:
-lm