TheAlgorithms/C++ 1.0.0
All the algorithms implemented in C++
|
Calculate the square root of any positive real number in \(O(\log N)\) time, with precision fixed using bisection method of root-finding. More...
#include <cassert>
#include <iostream>
Go to the source code of this file.
Functions | |
double | Sqrt (double a) |
int | main () |
Calculate the square root of any positive real number in \(O(\log N)\) time, with precision fixed using bisection method of root-finding.
Definition in file sqrt_double.cpp.
int main | ( | void | ) |
main function
Definition at line 42 of file sqrt_double.cpp.
double Sqrt | ( | double | a | ) |
Bisection method implemented for the function \(x^2-a=0\) whose roots are \(\pm\sqrt{a}\) and only the positive root is returned.
Definition at line 16 of file sqrt_double.cpp.