summaryrefslogtreecommitdiff
path: root/src/lib/math/sin.go
diff options
context:
space:
mode:
authorRuss Cox <rsc@golang.org>2009-03-05 13:31:01 -0800
committerRuss Cox <rsc@golang.org>2009-03-05 13:31:01 -0800
commit914dfea5a0dc5ea0394454f578cbaab72129144a (patch)
treee1f13f75b71d0f8d14fe489e49dde626f33a4b9d /src/lib/math/sin.go
parentb5b656313a007879be8f0c1564a89c85d0fd8b31 (diff)
downloadgolang-914dfea5a0dc5ea0394454f578cbaab72129144a.tar.gz
math: doc
R=r DELTA=173 (74 added, 14 deleted, 85 changed) OCL=25753 CL=25767
Diffstat (limited to 'src/lib/math/sin.go')
-rw-r--r--src/lib/math/sin.go17
1 files changed, 9 insertions, 8 deletions
diff --git a/src/lib/math/sin.go b/src/lib/math/sin.go
index 9c7b39bf8..9fc69606c 100644
--- a/src/lib/math/sin.go
+++ b/src/lib/math/sin.go
@@ -6,7 +6,7 @@ package math
import "math"
-func sinus(arg float64, quad int) float64 {
+func sinus(x float64, quad int) float64 {
// Coefficients are #3370 from Hart & Cheney (18.80D).
const
(
@@ -20,7 +20,6 @@ func sinus(arg float64, quad int) float64 {
Q2 = .9463096101538208180571257e4;
Q3 = .1326534908786136358911494e3;
)
- x := arg;
if(x < 0) {
x = -x;
quad = quad+2;
@@ -52,13 +51,15 @@ func sinus(arg float64, quad int) float64 {
return temp1/temp2;
}
-func Cos(arg float64) float64 {
- if arg < 0 {
- arg = -arg;
+// Cos returns the cosine of x.
+func Cos(x float64) float64 {
+ if x < 0 {
+ x = -x;
}
- return sinus(arg, 1);
+ return sinus(x, 1);
}
-func Sin(arg float64) float64 {
- return sinus(arg, 0);
+// Sin returns the sine of x.
+func Sin(x float64) float64 {
+ return sinus(x, 0);
}