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. 4 5package math_test 6 7import ( 8 "fmt" 9 "math" 10) 11 12func ExampleAcos() { 13 fmt.Printf("%.2f", math.Acos(1)) 14 // Output: 0.00 15} 16 17func ExampleAcosh() { 18 fmt.Printf("%.2f", math.Acosh(1)) 19 // Output: 0.00 20} 21 22func ExampleAsin() { 23 fmt.Printf("%.2f", math.Asin(0)) 24 // Output: 0.00 25} 26 27func ExampleAsinh() { 28 fmt.Printf("%.2f", math.Asinh(0)) 29 // Output: 0.00 30} 31 32func ExampleAtan() { 33 fmt.Printf("%.2f", math.Atan(0)) 34 // Output: 0.00 35} 36 37func ExampleAtan2() { 38 fmt.Printf("%.2f", math.Atan2(0, 0)) 39 // Output: 0.00 40} 41 42func ExampleAtanh() { 43 fmt.Printf("%.2f", math.Atanh(0)) 44 // Output: 0.00 45} 46 47func ExampleCos() { 48 fmt.Printf("%.2f", math.Cos(math.Pi/2)) 49 // Output: 0.00 50} 51 52func ExampleCosh() { 53 fmt.Printf("%.2f", math.Cosh(0)) 54 // Output: 1.00 55} 56 57func ExampleSin() { 58 fmt.Printf("%.2f", math.Sin(math.Pi)) 59 // Output: 0.00 60} 61 62func ExampleSincos() { 63 sin, cos := math.Sincos(0) 64 fmt.Printf("%.2f, %.2f", sin, cos) 65 // Output: 0.00, 1.00 66} 67 68func ExampleSinh() { 69 fmt.Printf("%.2f", math.Sinh(0)) 70 // Output: 0.00 71} 72 73func ExampleTan() { 74 fmt.Printf("%.2f", math.Tan(0)) 75 // Output: 0.00 76} 77 78func ExampleTanh() { 79 fmt.Printf("%.2f", math.Tanh(0)) 80 // Output: 0.00 81} 82 83func ExampleSqrt() { 84 const ( 85 a = 3 86 b = 4 87 ) 88 c := math.Sqrt(a*a + b*b) 89 fmt.Printf("%.1f", c) 90 // Output: 5.0 91} 92