Originally Posted by
shouse
no i found it just using %.20f during the printf
That has nothing to do with the accuracy of your floating point calculations. Try this:
Code:
printf("%.20f\n", 1.0 / 3.0);
If your hypothesis is correct (i.e. that %.20f gives 20 digits precision), you would get 0.333 repeating. Odds are you won't (although it does depend on the accuracy of your doubles).
You can try using a long double, which was introduced in C99; it's not guaranteed to have greater accuracy than double, but it well might.