标签:style blog java 2014 cti for
牛顿法求平方根公式:参数:要求平方根的数,迭代次数
var sqrt = function (a,accur){ var pre = 1; for(var i = 0;i<accur;i++){ var cur = 1/2 * (pre + a/pre); pre = cur; } return cur; } console.log(sqrt(2,10000));
标签:style blog java 2014 cti for
原文地址:http://blog.csdn.net/lan_liang/article/details/37365667