]> Cypherpunks repositories - gostls13.git/commitdiff
math/cmplx: specify which square root Sqrt returns
authorRuss Cox <rsc@golang.org>
Fri, 9 May 2014 20:04:03 +0000 (16:04 -0400)
committerRuss Cox <rsc@golang.org>
Fri, 9 May 2014 20:04:03 +0000 (16:04 -0400)
Fixes #7851.

LGTM=bradfitz
R=golang-codereviews, bradfitz
CC=golang-codereviews
https://golang.org/cl/93200043

src/pkg/math/cmplx/sqrt.go

index 179b5396abcc4bca5ad635ef0c098b7f25f04284..4ef6807addc9e1feed74a8c5738d6a5bc1e4f608 100644 (file)
@@ -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 {