From: Russ Cox Date: Fri, 9 May 2014 20:04:03 +0000 (-0400) Subject: math/cmplx: specify which square root Sqrt returns X-Git-Tag: go1.3beta2~114 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=2182d5786b728bc2371b40f689ca73ee9df0cd88;p=gostls13.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 --- diff --git a/src/pkg/math/cmplx/sqrt.go b/src/pkg/math/cmplx/sqrt.go index 179b5396ab..4ef6807add 100644 --- a/src/pkg/math/cmplx/sqrt.go +++ b/src/pkg/math/cmplx/sqrt.go @@ -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 {