企业🤖AI智能体构建引擎,智能编排和调试,一键部署,支持私有化部署方案 广告
~~~ 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)