1
0
mirror of https://github.com/golang/go synced 2024-11-21 22:34:48 -07:00

Clean up and make consistent the comments in the math package.

R=rsc
CC=golang-dev
https://golang.org/cl/186042
This commit is contained in:
Rob Pike 2010-01-12 07:38:31 +11:00
parent 093146b920
commit 00e2cda624
11 changed files with 60 additions and 64 deletions

View File

@ -6,10 +6,10 @@ package math
/*
* asin(arg) and acos(arg) return the arcsin, arccos,
* respectively of their arguments.
*
* Arctan is called after appropriate range reduction.
Floating-point sine and cosine.
They are implemented by computing the arctangent
after appropriate range reduction.
*/
// Asin returns the arcsine of x.

View File

@ -5,18 +5,16 @@
package math
/*
* floating-point arctangent
*
* atan returns the value of the arctangent of its
* argument in the range [-pi/2,pi/2].
* there are no error returns.
* coefficients are #5077 from Hart & Cheney. (19.56D)
Floating-point arctangent.
Atan returns the value of the arctangent of its
argument in the range [-pi/2,pi/2].
There are no error returns.
Coefficients are #5077 from Hart & Cheney. (19.56D)
*/
/*
* xatan evaluates a series valid in the
* range [-0.414...,+0.414...]. (tan(pi/8))
*/
// xatan evaluates a series valid in the
// range [-0.414...,+0.414...]. (tan(pi/8))
func xatan(arg float64) float64 {
const (
P4 = .161536412982230228262e2
@ -36,10 +34,8 @@ func xatan(arg float64) float64 {
return value * arg
}
/*
* satan reduces its argument (known to be positive)
* to the range [0,0.414...] and calls xatan.
*/
// satan reduces its argument (known to be positive)
// to the range [0,0.414...] and calls xatan.
func satan(arg float64) float64 {
if arg < Sqrt2-1 {
return xatan(arg)
@ -50,11 +46,6 @@ func satan(arg float64) float64 {
return Pi/4 + xatan((arg-1)/(arg+1))
}
/*
* Atan makes its argument positive and
* calls the inner routine satan.
*/
// Atan returns the arctangent of x.
func Atan(x float64) float64 {
if x > 0 {

View File

@ -6,7 +6,7 @@ package math
/*
* floating-point mod func without infinity or NaN checking
Floating-point mod func without infinity or NaN checking
*/
// Fmod returns the floating-point remainder of x/y.

View File

@ -5,11 +5,12 @@
package math
/*
* hypot -- sqrt(p*p + q*q), but overflows only if the result does.
* See Cleve Moler and Donald Morrison,
* Replacing Square Roots by Pythagorean Sums
* IBM Journal of Research and Development,
* Vol. 27, Number 6, pp. 577-581, Nov. 1983
Hypot -- sqrt(p*p + q*q), but overflows only if the result does.
See:
Cleve Moler and Donald Morrison,
Replacing Square Roots by Pythagorean Sums
IBM Journal of Research and Development,
Vol. 27, Number 6, pp. 577-581, Nov. 1983
*/
// Hypot computes Sqrt(p*p + q*q), taking care to avoid

View File

@ -4,6 +4,9 @@
package math
/*
Floating-point logarithm.
*/
// The original C code, the long comment, and the constants
// below are from FreeBSD's /usr/src/lib/msun/src/e_log.c

View File

@ -4,15 +4,8 @@
package math
/*
* this table might overflow 127-bit exponent representations.
* in that case, truncate it after 1.0e38.
* it is important to get all one can from this
* routine since it is used in atof to scale numbers.
* the presumption is that GO converts fp numbers better
* than multipication of lower powers of 10.
*/
// This table might overflow 127-bit exponent representations.
// In that case, truncate it after 1.0e38.
var pow10tab [70]float64
// Pow10 returns 10**e, the base-10 exponential of e.

View File

@ -5,8 +5,13 @@
package math
/*
Floating-point sine and cosine.
Coefficients are #5077 from Hart & Cheney. (18.80D)
*/
func sinus(x float64, quad int) float64 {
// Coefficients are #3370 from Hart & Cheney (18.80D).
const (
P0 = .1357884097877375669092680e8
P1 = -.4942908100902844161158627e7

View File

@ -6,15 +6,15 @@ package math
/*
* Sinh(x) returns the hyperbolic sine of x
*
* The exponential func is called for arguments
* greater in magnitude than 0.5.
*
* A series is used for arguments smaller in magnitude than 0.5.
*
* Cosh(x) is computed from the exponential func for
* all arguments.
Floating-point hyperbolic sine and cosine.
The exponential func is called for arguments
greater in magnitude than 0.5.
A series is used for arguments smaller in magnitude than 0.5.
Cosh(x) is computed from the exponential func for
all arguments.
*/
// Sinh returns the hyperbolic sine of x.

View File

@ -4,6 +4,10 @@
package math
/*
Floating-point square root.
*/
// The original C code and the long comment below are
// from FreeBSD's /usr/src/lib/msun/src/e_sqrt.c and
// came with this notice. The go code is a simplified

View File

@ -6,7 +6,7 @@ package math
/*
* floating point tangent
Floating point tangent.
*/
// Tan returns the tangent of x.

View File

@ -6,11 +6,10 @@ package math
/*
* tanh(x) computes the hyperbolic tangent of its floating
* point argument.
*
* sinh and cosh are called except for large arguments, which
* would cause overflow improperly.
Floating-point hyperbolic tangent.
Sinh and Cosh are called except for large arguments, which
would cause overflow improperly.
*/
// Tanh computes the hyperbolic tangent of x.