1 // Copyright 2017 The Go Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style
3 // license that can be found in the LICENSE file.
13 fmt.Printf("%.2f", math.Acos(1))
18 fmt.Printf("%.2f", math.Acosh(1))
23 fmt.Printf("%.2f", math.Asin(0))
28 fmt.Printf("%.2f", math.Asinh(0))
33 fmt.Printf("%.2f", math.Atan(0))
38 fmt.Printf("%.2f", math.Atan2(0, 0))
43 fmt.Printf("%.2f", math.Atanh(0))
48 fmt.Printf("%.2f", math.Cos(math.Pi/2))
53 fmt.Printf("%.2f", math.Cosh(0))
58 fmt.Printf("%.2f", math.Sin(math.Pi))
62 func ExampleSincos() {
63 sin, cos := math.Sincos(0)
64 fmt.Printf("%.2f, %.2f", sin, cos)
69 fmt.Printf("%.2f", math.Sinh(0))
74 fmt.Printf("%.2f", math.Tan(0))
79 fmt.Printf("%.2f", math.Tanh(0))
88 c := math.Sqrt(a*a + b*b)
100 c := math.Floor(1.51)
101 fmt.Printf("%.1f", c)
107 fmt.Printf("%.1f", c)
111 func ExamplePow10() {
113 fmt.Printf("%.1f", c)
117 func ExampleRound() {
118 p := math.Round(10.5)
119 fmt.Printf("%.1f\n", p)
121 n := math.Round(-10.5)
122 fmt.Printf("%.1f\n", n)
128 func ExampleRoundToEven() {
129 u := math.RoundToEven(11.5)
130 fmt.Printf("%.1f\n", u)
132 d := math.RoundToEven(12.5)
133 fmt.Printf("%.1f\n", d)
141 fmt.Printf("%.1f\n", x)
143 y := math.Log(2.7183)
144 fmt.Printf("%.1f\n", y)
151 fmt.Printf("%.1f", math.Log2(256))
155 func ExampleLog10() {
156 fmt.Printf("%.1f", math.Log10(100))
162 fmt.Printf("%.1f", c)
168 fmt.Printf("%.1f\n", x)
171 fmt.Printf("%.1f\n", y)