October 2nd, 2011, 09:34 AM

Yep, see above: float calculations have finite precision. And the result might fluctuate a little. :)

October 2nd, 2011, 09:32 AM

Well, the big mistake you make is that you think math and programming are the same. Floats in programming have finite precision, so you must take certain precautions and tricks to succeed with your...

October 2nd, 2011, 09:25 AM

I don't know what's wrong with your code, but mine works fine:

#include <stdio.h>

int main()

{

float a = -0.1;

printf("%f", a +0.1);

return 0;

}

October 2nd, 2011, 09:13 AM

It's impossible to succeed with the condition fabsf(c - a) < 0.0. Victor meant something like fabsf(c - a) < 0.00001.

October 2nd, 2011, 09:07 AM

Result of 1/0 is infinity, while programming languages operate with only finite figures. So you have the best result FPU was able to provide. :)