summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjaredculp <jculp14@gmail.com>2017-08-10 17:00:59 -0400
committerIan Lance Taylor <iant@golang.org>2017-08-25 20:26:19 +0000
commitdc42ffff594b12455b4e419bdae4cb707f602f4a (patch)
treec5d4b475c47bd84675dcd1654ea0fc1a91f26a22
parentc02fc1605ad1816f95f61811883dbcdb38a9aec6 (diff)
downloadgo-git-dc42ffff594b12455b4e419bdae4cb707f602f4a.tar.gz
math: add examples for trig functions
Change-Id: Ic3ce2f3c055f2636ec8fc9cec8592e596b18dc05 Reviewed-on: https://go-review.googlesource.com/54771 Run-TryBot: Ian Lance Taylor <iant@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org>
-rw-r--r--src/math/example_test.go71
1 files changed, 71 insertions, 0 deletions
diff --git a/src/math/example_test.go b/src/math/example_test.go
index 12e9876730..feaf9d8252 100644
--- a/src/math/example_test.go
+++ b/src/math/example_test.go
@@ -9,6 +9,77 @@ import (
"math"
)
+func ExampleAcos() {
+ fmt.Printf("%.2f", math.Acos(1))
+ // Output: 0.00
+}
+
+func ExampleAcosh() {
+ fmt.Printf("%.2f", math.Acosh(1))
+ // Output: 0.00
+}
+
+func ExampleAsin() {
+ fmt.Printf("%.2f", math.Asin(0))
+ // Output: 0.00
+}
+
+func ExampleAsinh() {
+ fmt.Printf("%.2f", math.Asinh(0))
+ // Output: 0.00
+}
+
+func ExampleAtan() {
+ fmt.Printf("%.2f", math.Atan(0))
+ // Output: 0.00
+}
+
+func ExampleAtan2() {
+ fmt.Printf("%.2f", math.Atan2(0, 0))
+ // Output: 0.00
+}
+
+func ExampleAtanh() {
+ fmt.Printf("%.2f", math.Atanh(0))
+ // Output: 0.00
+}
+
+func ExampleCos() {
+ fmt.Printf("%.2f", math.Cos(math.Pi/2))
+ // Output: 0.00
+}
+
+func ExampleCosh() {
+ fmt.Printf("%.2f", math.Cosh(0))
+ // Output: 1.00
+}
+
+func ExampleSin() {
+ fmt.Printf("%.2f", math.Sin(math.Pi))
+ // Output: 0.00
+}
+
+func ExampleSincos() {
+ sin, cos := math.Sincos(0)
+ fmt.Printf("%.2f, %.2f", sin, cos)
+ // Output: 0.00, 1.00
+}
+
+func ExampleSinh() {
+ fmt.Printf("%.2f", math.Sinh(0))
+ // Output: 0.00
+}
+
+func ExampleTan() {
+ fmt.Printf("%.2f", math.Tan(0))
+ // Output: 0.00
+}
+
+func ExampleTanh() {
+ fmt.Printf("%.2f", math.Tanh(0))
+ // Output: 0.00
+}
+
func ExampleSqrt() {
const (
a = 3