diff options
author | Charles L. Dorian <cldorian@gmail.com> | 2011-12-05 14:01:24 -0500 |
---|---|---|
committer | Russ Cox <rsc@golang.org> | 2011-12-05 14:01:24 -0500 |
commit | abc7df9686839950f3a2ce108a5a683cce9001fe (patch) | |
tree | 849e18b061870676a31508cb69d0068be4af31cc | |
parent | 3538d40ab5f57db77b3a76822c555a76020588f0 (diff) | |
download | go-abc7df9686839950f3a2ce108a5a683cce9001fe.tar.gz go-abc7df9686839950f3a2ce108a5a683cce9001fe.zip |
math: add special-cases comments to Sinh and Tanh.
Also change "Special conditions" to "Special cases" as in other functions.
R=rsc, golang-dev
CC=golang-dev
https://golang.org/cl/5440078
-rw-r--r-- | src/pkg/math/sin.go | 2 | ||||
-rw-r--r-- | src/pkg/math/sincos.go | 2 | ||||
-rw-r--r-- | src/pkg/math/sinh.go | 10 | ||||
-rw-r--r-- | src/pkg/math/tan.go | 2 | ||||
-rw-r--r-- | src/pkg/math/tanh.go | 5 |
5 files changed, 18 insertions, 3 deletions
diff --git a/src/pkg/math/sin.go b/src/pkg/math/sin.go index 9e553a268b..b2a3f8a4e0 100644 --- a/src/pkg/math/sin.go +++ b/src/pkg/math/sin.go @@ -110,7 +110,7 @@ var _cos = [...]float64{ // Cos returns the cosine of x. // -// Special conditions are: +// Special cases are: // Cos(±Inf) = NaN // Cos(NaN) = NaN func Cos(x float64) float64 { diff --git a/src/pkg/math/sincos.go b/src/pkg/math/sincos.go index f5412fd726..74294256be 100644 --- a/src/pkg/math/sincos.go +++ b/src/pkg/math/sincos.go @@ -8,7 +8,7 @@ package math // Sincos(x) returns Sin(x), Cos(x). // -// Special conditions are: +// Special cases are: // Sincos(±0) = ±0, 1 // Sincos(±Inf) = NaN, NaN // Sincos(NaN) = NaN, NaN diff --git a/src/pkg/math/sinh.go b/src/pkg/math/sinh.go index eaf28a51cd..139b911fe6 100644 --- a/src/pkg/math/sinh.go +++ b/src/pkg/math/sinh.go @@ -17,6 +17,11 @@ package math */ // Sinh returns the hyperbolic sine of x. +// +// Special cases are: +// Sinh(±0) = ±0 +// Sinh(±Inf) = ±Inf +// Sinh(NaN) = NaN func Sinh(x float64) float64 { // The coefficients are #2029 from Hart & Cheney. (20.36D) const ( @@ -56,6 +61,11 @@ func Sinh(x float64) float64 { } // Cosh returns the hyperbolic cosine of x. +// +// Special cases are: +// Cosh(±0) = 1 +// Cosh(±Inf) = +Inf +// Cosh(NaN) = NaN func Cosh(x float64) float64 { if x < 0 { x = -x diff --git a/src/pkg/math/tan.go b/src/pkg/math/tan.go index 739ee80f76..76131fcd93 100644 --- a/src/pkg/math/tan.go +++ b/src/pkg/math/tan.go @@ -75,7 +75,7 @@ var _tanQ = [...]float64{ // Tan returns the tangent of x. // -// Special conditions are: +// Special cases are: // Tan(±0) = ±0 // Tan(±Inf) = NaN // Tan(NaN) = NaN diff --git a/src/pkg/math/tanh.go b/src/pkg/math/tanh.go index f4a8a5a4d6..03a641b4da 100644 --- a/src/pkg/math/tanh.go +++ b/src/pkg/math/tanh.go @@ -12,6 +12,11 @@ package math */ // Tanh computes the hyperbolic tangent of x. +// +// Special cases are: +// Tanh(±0) = ±0 +// Tanh(±Inf) = ±1 +// Tanh(NaN) = NaN func Tanh(x float64) float64 { if x < 0 { x = -x |