多应用+插件架构,代码干净,二开方便,首家独创一键云编译技术,文档视频完善,免费商用码云13.8K 广告
~~~ package main import ( "fmt" "math" ) func Sqrt(x float64) float64 { z := float64(1) tmp := float64(0) for math.Abs(tmp - z) > 0.0000000001 { tmp = z z = (z + x/z)/2 } return z } func main() { fmt.Println(Sqrt(2)) fmt.Println(math.Sqrt(2)) } ~~~ ![](https://box.kancloud.cn/032176b8778dbc41f1ce6b79a83d59c1_900x350.jpg)