Create a gist now

Instantly share code, notes, and snippets.

@thinkphp /ln.c
Created Mar 17, 2017

ln.c
double computesLN2(double n, double lo, double hi) {
double a = lo, b = hi, m;
while( fabs(a - b) > EPS ) {
m = (a + b) / 2.0;
if( (f( m, n) ) < 0) a = m;
else
b = m;
}
return (a+b)/2.0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment