Commit 2182d578 authored by Russ Cox's avatar Russ Cox

math/cmplx: specify which square root Sqrt returns

Fixes #7851.

LGTM=bradfitz
R=golang-codereviews, bradfitz
CC=golang-codereviews
https://golang.org/cl/93200043
parent e5c10503
...@@ -54,6 +54,7 @@ import "math" ...@@ -54,6 +54,7 @@ import "math"
// IEEE -10,+10 1,000,000 2.9e-16 6.1e-17 // IEEE -10,+10 1,000,000 2.9e-16 6.1e-17
// Sqrt returns the square root of x. // 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 { func Sqrt(x complex128) complex128 {
if imag(x) == 0 { if imag(x) == 0 {
if real(x) == 0 { if real(x) == 0 {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment