I was implementing an algorithm to calculate natural logs in C.
double taylor_ln(int z) {
double sum = 0.0;
double tmp = 1.0;
int i = 1;
whi
The print statement is displaying a rounded value, it is not printing the highest possible precision. So your loop has not really reached zero yet.
(And, as others have mentioned, due to rounding issues it might actually never reach it. Comparing the value against a small limit is therefore more robust than comparing for equality with 0.0.)