Commit abc7df96 authored by Charles L. Dorian's avatar Charles L. Dorian Committed by Russ Cox

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
parent 3538d40a
...@@ -110,7 +110,7 @@ var _cos = [...]float64{ ...@@ -110,7 +110,7 @@ var _cos = [...]float64{
// Cos returns the cosine of x. // Cos returns the cosine of x.
// //
// Special conditions are: // Special cases are:
// Cos(±Inf) = NaN // Cos(±Inf) = NaN
// Cos(NaN) = NaN // Cos(NaN) = NaN
func Cos(x float64) float64 { func Cos(x float64) float64 {
......
...@@ -8,7 +8,7 @@ package math ...@@ -8,7 +8,7 @@ package math
// Sincos(x) returns Sin(x), Cos(x). // Sincos(x) returns Sin(x), Cos(x).
// //
// Special conditions are: // Special cases are:
// Sincos(±0) = ±0, 1 // Sincos(±0) = ±0, 1
// Sincos(±Inf) = NaN, NaN // Sincos(±Inf) = NaN, NaN
// Sincos(NaN) = NaN, NaN // Sincos(NaN) = NaN, NaN
......
...@@ -17,6 +17,11 @@ package math ...@@ -17,6 +17,11 @@ package math
*/ */
// Sinh returns the hyperbolic sine of x. // Sinh returns the hyperbolic sine of x.
//
// Special cases are:
// Sinh(±0) = ±0
// Sinh(±Inf) = ±Inf
// Sinh(NaN) = NaN
func Sinh(x float64) float64 { func Sinh(x float64) float64 {
// The coefficients are #2029 from Hart & Cheney. (20.36D) // The coefficients are #2029 from Hart & Cheney. (20.36D)
const ( const (
...@@ -56,6 +61,11 @@ func Sinh(x float64) float64 { ...@@ -56,6 +61,11 @@ func Sinh(x float64) float64 {
} }
// Cosh returns the hyperbolic cosine of x. // Cosh returns the hyperbolic cosine of x.
//
// Special cases are:
// Cosh(±0) = 1
// Cosh(±Inf) = +Inf
// Cosh(NaN) = NaN
func Cosh(x float64) float64 { func Cosh(x float64) float64 {
if x < 0 { if x < 0 {
x = -x x = -x
......
...@@ -75,7 +75,7 @@ var _tanQ = [...]float64{ ...@@ -75,7 +75,7 @@ var _tanQ = [...]float64{
// Tan returns the tangent of x. // Tan returns the tangent of x.
// //
// Special conditions are: // Special cases are:
// Tan(±0) = ±0 // Tan(±0) = ±0
// Tan(±Inf) = NaN // Tan(±Inf) = NaN
// Tan(NaN) = NaN // Tan(NaN) = NaN
......
...@@ -12,6 +12,11 @@ package math ...@@ -12,6 +12,11 @@ package math
*/ */
// Tanh computes the hyperbolic tangent of x. // Tanh computes the hyperbolic tangent of x.
//
// Special cases are:
// Tanh(±0) = ±0
// Tanh(±Inf) = ±1
// Tanh(NaN) = NaN
func Tanh(x float64) float64 { func Tanh(x float64) float64 {
if x < 0 { if x < 0 {
x = -x x = -x
......
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