Skip to content

Instantly share code, notes, and snippets.

@thinkphp
Created March 17, 2017 07:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save thinkphp/7d020c2c012328899f554e306f796d7e to your computer and use it in GitHub Desktop.
Save thinkphp/7d020c2c012328899f554e306f796d7e to your computer and use it in GitHub Desktop.
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