]> Cypherpunks repositories - gostls13.git/commitdiff
cmath: add package description
authorCharles L. Dorian <cldorian@gmail.com>
Sat, 15 May 2010 17:06:54 +0000 (10:06 -0700)
committerRob Pike <r@golang.org>
Sat, 15 May 2010 17:06:54 +0000 (10:06 -0700)
Also update range of Phase and Polar due to signed zero.
[Phase(cmplx(-1, +0)) = pi and Phase(cmplx(-1, -0)) = -pi]

R=rsc, r
CC=golang-dev
https://golang.org/cl/1235041

src/pkg/cmath/abs.go
src/pkg/cmath/phase.go
src/pkg/cmath/polar.go

index 30995cec609eb524ba376085f4a3baedc2bda6af..725dc4e98218f413734b0edfce88fe7819b7c86d 100644 (file)
@@ -2,6 +2,8 @@
 // Use of this source code is governed by a BSD-style
 // license that can be found in the LICENSE file.
 
+// The cmath package provides basic constants
+// and mathematical functions for complex numbers.
 package cmath
 
 import "math"
index 97a48349270f9c538e029fb25e62023c51e7e098..2d67aa34c7ff7109cd93d14e6d871f799206c331 100644 (file)
@@ -7,5 +7,5 @@ package cmath
 import "math"
 
 // Phase returns the phase (also called the argument) of x.
-// The returned value is in the range (-Pi, Pi].
+// The returned value is in the range [-Pi, Pi].
 func Phase(x complex128) float64 { return math.Atan2(imag(x), real(x)) }
index f55aef42b0c8aca6c43cfe192e4977fb303a09fc..033676acc5f8fa23db28e3a081a1ca68d3f08694 100644 (file)
@@ -6,7 +6,7 @@ package cmath
 
 // Polar returns the absolute value r and phase θ of x,
 // such that x = r * e**θi.
-// The phase is in the range (-Pi, Pi].
+// The phase is in the range [-Pi, Pi].
 func Polar(x complex128) (r, θ float64) {
        return Abs(x), Phase(x)
 }