From efddc161d2a15529b4b3ac27fab5a557b88ae443 Mon Sep 17 00:00:00 2001 From: Andrii Soldatenko Date: Wed, 13 Jun 2018 18:58:09 +0300 Subject: [PATCH] math: add examples to Ceil, Floor, Pow, Pow10 functions Change-Id: I9154df128b349c102854bb0f21e4c313685dd0e6 Reviewed-on: https://go-review.googlesource.com/118659 Reviewed-by: Brad Fitzpatrick Run-TryBot: Brad Fitzpatrick TryBot-Result: Gobot Gobot --- src/math/example_test.go | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/src/math/example_test.go b/src/math/example_test.go index feaf9d8252..a1f764bcda 100644 --- a/src/math/example_test.go +++ b/src/math/example_test.go @@ -89,3 +89,27 @@ func ExampleSqrt() { fmt.Printf("%.1f", c) // Output: 5.0 } + +func ExampleCeil() { + c := math.Ceil(1.49) + fmt.Printf("%.1f", c) + // Output: 2.0 +} + +func ExampleFloor() { + c := math.Floor(1.51) + fmt.Printf("%.1f", c) + // Output: 1.0 +} + +func ExamplePow() { + c := math.Pow(2, 3) + fmt.Printf("%.1f", c) + // Output: 8.0 +} + +func ExamplePow10() { + c := math.Pow10(2) + fmt.Printf("%.1f", c) + // Output: 100.0 +} -- 2.50.0