diff options
author | kakulisen <lziqiang1@gmail.com> | 2020-04-29 15:43:11 +0800 |
---|---|---|
committer | Robert Griesemer <gri@golang.org> | 2020-04-30 00:33:38 +0000 |
commit | df2862cf54858ba5b1ada7d2ca99e57f3c13dd23 (patch) | |
tree | f7f2a0a550658be80faddfda61c7ba7b76e864c7 /src/math | |
parent | 844b410922b2ea7d22b651c536178e79696749f6 (diff) | |
download | go-df2862cf54858ba5b1ada7d2ca99e57f3c13dd23.tar.gz go-df2862cf54858ba5b1ada7d2ca99e57f3c13dd23.zip |
math: Add a function example
When I browsed the source code, I saw that there is no corresponding example of this function. I am not sure if there is a need for an increase, this is my first time to submit CL.
Change-Id: Idbf4e1e1ed2995176a76959d561e152263a2fd26
Reviewed-on: https://go-review.googlesource.com/c/go/+/230741
Run-TryBot: Robert Griesemer <gri@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Robert Griesemer <gri@golang.org>
Diffstat (limited to 'src/math')
-rw-r--r-- | src/math/example_test.go | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/math/example_test.go b/src/math/example_test.go index 50c7426979..ce9c383256 100644 --- a/src/math/example_test.go +++ b/src/math/example_test.go @@ -219,3 +219,11 @@ func ExampleTrunc() { // 3.00 // -1.00 } + +func ExampleCbrt() { + fmt.Printf("%.2f\n", math.Cbrt(8)) + fmt.Printf("%.2f\n", math.Cbrt(27)) + // Output: + // 2.00 + // 3.00 +} |