I use Gentoo Linux, Gcc 4.1.1 and Intel Celeron processor.

I compiled this file:

#include <stdio.h>
#include <math.h>

int main()
{
printf("\n %1.55f \n", sqrt(3.999999999999999));
return 0;
}

I get 1.999999999999999777955395074968691915273666381835 9375000

If you add one more 9 to sqrt you get 2.


#include <stdio.h>
#include <math.h>

int main()
{
printf("\n %1.55f \n", sqrt(3.9999999999999999));
return 0;
}

Result: 2

Why does this return 2 ??

Miha Svalina


Reply via email to