gcc/libgo/go/math/example_test.go
Ian Lance Taylor 1a2f01efa6 libgo: update to Go1.10beta1
Update the Go library to the 1.10beta1 release.
    
    Requires a few changes to the compiler for modifications to the map
    runtime code, and to handle some nowritebarrier cases in the runtime.
    
    Reviewed-on: https://go-review.googlesource.com/86455

gotools/:
	* Makefile.am (go_cmd_vet_files): New variable.
	(go_cmd_buildid_files, go_cmd_test2json_files): New variables.
	(s-zdefaultcc): Change from constants to functions.
	(noinst_PROGRAMS): Add vet, buildid, and test2json.
	(cgo$(EXEEXT)): Link against $(LIBGOTOOL).
	(vet$(EXEEXT)): New target.
	(buildid$(EXEEXT)): New target.
	(test2json$(EXEEXT)): New target.
	(install-exec-local): Install all $(noinst_PROGRAMS).
	(uninstall-local): Uninstasll all $(noinst_PROGRAMS).
	(check-go-tool): Depend on $(noinst_PROGRAMS).  Copy down
	objabi.go.
	(check-runtime): Depend on $(noinst_PROGRAMS).
	(check-cgo-test, check-carchive-test): Likewise.
	(check-vet): New target.
	(check): Depend on check-vet.  Look at cmd_vet-testlog.
	(.PHONY): Add check-vet.
	* Makefile.in: Rebuild.

From-SVN: r256365
2018-01-09 01:23:08 +00:00

92 lines
1.4 KiB
Go

// Copyright 2017 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package math_test
import (
"fmt"
"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
b = 4
)
c := math.Sqrt(a*a + b*b)
fmt.Printf("%.1f", c)
// Output: 5.0
}