math/big: add function example
While reading the source code of the math/big package, I found the SetString function example of float type missing.
Change-Id: Id8c16a58e2e24f9463e8ff38adbc98f8c418ab26
Reviewed-on: https://go-review.googlesource.com/c/go/+/232804
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Robert Griesemer <gri@golang.org>
diff --git a/src/math/big/example_test.go b/src/math/big/example_test.go
index cfc7735..31ca784 100644
--- a/src/math/big/example_test.go
+++ b/src/math/big/example_test.go
@@ -25,6 +25,13 @@
// Output: 420
}
+func ExampleFloat_SetString() {
+ f := new(big.Float)
+ f.SetString("3.14159")
+ fmt.Println(f)
+ // Output: 3.14159
+}
+
func ExampleRat_Scan() {
// The Scan function is rarely used directly;
// the fmt package recognizes it as an implementation of fmt.Scanner.