📜  平方根牛顿法 javascript 代码示例

📅  最后修改于: 2022-03-11 15:03:36.357000             🧑  作者: Mango

代码示例1
let sqrt = (c, depth = 100, x = 1) =>
    depth <= 0 ? x :
    sqrt(c, depth - 1, x - (Math.pow(x, 2) - c)/(2*x))

console.log(sqrt(2));