diff options
author | Andrii Soldatenko <andrii.soldatenko@gmail.com> | 2018-06-13 18:58:09 +0300 |
---|---|---|
committer | Brad Fitzpatrick <bradfitz@golang.org> | 2018-06-13 22:01:28 +0000 |
commit | efddc161d2a15529b4b3ac27fab5a557b88ae443 (patch) | |
tree | 382e026f0abd79500f06af4a0c5d0a7efc0e1062 /src/math | |
parent | a7d89572beebceec6d7ea3c1868fdb2fbc69c512 (diff) | |
download | go-git-efddc161d2a15529b4b3ac27fab5a557b88ae443.tar.gz |
math: add examples to Ceil, Floor, Pow, Pow10 functions
Change-Id: I9154df128b349c102854bb0f21e4c313685dd0e6
Reviewed-on: https://go-review.googlesource.com/118659
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Diffstat (limited to 'src/math')
-rw-r--r-- | src/math/example_test.go | 24 |
1 files changed, 24 insertions, 0 deletions
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 +} |