I was trying to figure out the Newton's method to find the root of equation. And this bug came out and I couldn't handle it.
double fn(double n){
return sin(n)+log(n)-1;
}
double f1n(double n){
return cos(n)+1/n;
}
double operation(double n){
n=n-fn/f1n;
while(fn>0.000001){
n=n-fn/f1n;
}
return n;
}