]> Cypherpunks repositories - gostls13.git/commitdiff
Clean up and make consistent the comments in the math package.
authorRob Pike <r@golang.org>
Mon, 11 Jan 2010 20:38:31 +0000 (07:38 +1100)
committerRob Pike <r@golang.org>
Mon, 11 Jan 2010 20:38:31 +0000 (07:38 +1100)
R=rsc
CC=golang-dev
https://golang.org/cl/186042

src/pkg/math/asin.go
src/pkg/math/atan.go
src/pkg/math/fmod.go
src/pkg/math/hypot.go
src/pkg/math/log.go
src/pkg/math/pow10.go
src/pkg/math/sin.go
src/pkg/math/sinh.go
src/pkg/math/sqrt_port.go
src/pkg/math/tan.go
src/pkg/math/tanh.go

index 439673a3a7ed7544f290bd8fa7347bb428d176c4..a9df6631133cfc5c28fa95e5af081636e9132711 100644 (file)
@@ -6,13 +6,13 @@ 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.
 
-// Asin returns the arc sine of x.
+       They are implemented by computing the arctangent
+       after appropriate range reduction.
+*/
+
+// Asin returns the arcsine of x.
 func Asin(x float64) float64 {
        sign := false
        if x < 0 {
@@ -36,5 +36,5 @@ func Asin(x float64) float64 {
        return temp
 }
 
-// Acos returns the arc cosine of x.
+// Acos returns the arccosine of x.
 func Acos(x float64) float64 { return Pi/2 - Asin(x) }
index 99a986ac77afc0b48e2e42e8a440323b10099c1a..654fd4bdc94b5836ffa278b7c4289799f1a74f92 100644 (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.
 
-/*
- *     xatan evaluates a series valid in the
- *     range [-0.414...,+0.414...]. (tan(pi/8))
- */
+       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))
 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,12 +46,7 @@ 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 arc tangent of x.
+// Atan returns the arctangent of x.
 func Atan(x float64) float64 {
        if x > 0 {
                return satan(x)
index d88ad535928d93fa2fa6ce02aa996f23e7a409a6..cff9ae497b191acb055be1f9fc8d578728336be2 100644 (file)
@@ -6,8 +6,8 @@ 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.
 func Fmod(x, y float64) float64 {
index 4370c229544970ec49cfb960330e16c784a814eb..760fc9da4d206415cb9e36853d4c7d817fdba85c 100644 (file)
@@ -5,12 +5,13 @@
 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
 // unnecessary overflow and underflow.
index 0564689f48335b8f4024d54439f198e36d6858d1..12b3f649899b82cbe05c276cbfbcca1efee5c1a9 100644 (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
index 4835f6dcefe299413550f41b38e52cb048af2aeb..bda2e824ef1c3d58c4ce3072456a62796e5b73a0 100644 (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.
index e17daf688ca710a2027f9905020c8101db03d6ff..35220cb3e5a93a7e8da80af365c6020465fcdb60 100644 (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
index 8d70cd3ddbe2557f9dec2f1578ed2e5bdfc724fe..23a8719f2cac914bf23375fa91486f47d5349078 100644 (file)
@@ -6,16 +6,16 @@ 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.
 func Sinh(x float64) float64 {
index feccbc6199cb4197e1674e3669bc1ff5909e3d21..125afcd985ba3660d305c7967d462ea798f02830 100644 (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
index 05ba232a7bce8ee48ce0169e99e084b807e2ad55..842ac643861643c0fb1a9209470343f8b89c39ee 100644 (file)
@@ -6,8 +6,8 @@ package math
 
 
 /*
- *     floating point tangent
- */
+       Floating point tangent.
+*/
 
 // Tan returns the tangent of x.
 func Tan(x float64) float64 {
index 144c08530dd315824bb8382cbd50bbcc294b768a..8bcf2ddac2eaac1480998a2de3c2598bde3d8ae8 100644 (file)
@@ -6,12 +6,11 @@ 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.
 func Tanh(x float64) float64 {