Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 79e08d3

Browse filesBrowse files
Update 求平方根.md
1 parent ca344dd commit 79e08d3
Copy full SHA for 79e08d3

File tree

1 file changed

+25
-0
lines changed
Filter options

1 file changed

+25
-0
lines changed

‎Dichotomy/求平方根.md

Copy file name to clipboardExpand all lines: Dichotomy/求平方根.md
+25Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,3 +31,28 @@ public class SquareRoot {
3131

3232
```
3333

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

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.