aboutsummaryrefslogtreecommitdiff
path: root/src/math
diff options
context:
space:
mode:
authorkakulisen <lziqiang1@gmail.com>2020-04-29 15:43:11 +0800
committerRobert Griesemer <gri@golang.org>2020-04-30 00:33:38 +0000
commitdf2862cf54858ba5b1ada7d2ca99e57f3c13dd23 (patch)
treef7f2a0a550658be80faddfda61c7ba7b76e864c7 /src/math
parent844b410922b2ea7d22b651c536178e79696749f6 (diff)
downloadgo-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.go8
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
+}