Skip to content

Instantly share code, notes, and snippets.

@abhimanyu-bitsgoa
Last active November 11, 2020 15:34
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 abhimanyu-bitsgoa/89741f4081077ad141f0baa5d763fc9d to your computer and use it in GitHub Desktop.
Save abhimanyu-bitsgoa/89741f4081077ad141f0baa5d763fc9d to your computer and use it in GitHub Desktop.
double sq(double num)
{
double xn = num/2;
while(abs((xn*xn)-num)>eps) //eps is precision
{
xn = (xn + num/xn)/2;
}
return xn;
}
@abhimanyu-bitsgoa
Copy link
Author

Change abs typo

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment