mirror of https://github.com/golang/go.git
math/cmplx: specify which square root Sqrt returns
Fixes #7851. LGTM=bradfitz R=golang-codereviews, bradfitz CC=golang-codereviews https://golang.org/cl/93200043
This commit is contained in:
parent
e5c105033a
commit
2182d5786b
|
|
@ -54,6 +54,7 @@ import "math"
|
|||
// IEEE -10,+10 1,000,000 2.9e-16 6.1e-17
|
||||
|
||||
// Sqrt returns the square root of x.
|
||||
// The result r is chosen so that real(r) ≥ 0 and imag(r) has the same sign as imag(x).
|
||||
func Sqrt(x complex128) complex128 {
|
||||
if imag(x) == 0 {
|
||||
if real(x) == 0 {
|
||||
|
|
|
|||
Loading…
Reference in New Issue