From: Andrii Soldatenko Date: Wed, 13 Jun 2018 15:58:09 +0000 (+0300) Subject: math: add examples to Ceil, Floor, Pow, Pow10 functions X-Git-Tag: go1.11beta1~106 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=efddc161d2a15529b4b3ac27fab5a557b88ae443;p=gostls13.git 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 --- 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 +}