We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent ca344dd commit 79e08d3Copy full SHA for 79e08d3
Dichotomy/求平方根.md
@@ -31,3 +31,28 @@ public class SquareRoot {
31
32
```
33
34
+
35
36
+Go 语言:
37
38
+```go
39
+package main
40
41
+import "fmt"
42
43
+func main() {
44
+ num := 8
45
+ target, left, right := float64(num), float64(0), float64(num)
46
+ for right-left > 1e-7 {
47
+ mid := (left + right) / 2
48
+ if mid*mid > target {
49
+ right = mid
50
+ } else {
51
+ left = mid
52
+ }
53
54
+ fmt.Println(left)
55
+ fmt.Println(right)
56
+}
57
+```
58
0 commit comments