mirror of
https://github.com/TheAlgorithms/JavaScript.git
synced 2025-07-06 01:18:23 +08:00
chore(SquareRoot.js): Better Precision constant
This commit is contained in:
@ -6,7 +6,7 @@
|
||||
* Finding the square root of a number using Newton's method.
|
||||
*/
|
||||
|
||||
function sqrt (num, precision = 10) {
|
||||
function sqrt (num, precision = 4) {
|
||||
if (!Number.isFinite(num)) { throw new TypeError(`Expected a number, received ${typeof num}`) }
|
||||
if (!Number.isFinite(precision)) { throw new TypeError(`Expected a number, received ${typeof precision}`) }
|
||||
let sqrt = 1
|
||||
|
Reference in New Issue
Block a user