mirror of
https://github.com/golang/go
synced 2024-09-30 00:14:36 -06:00
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>
This commit is contained in:
parent
3ffa1381ec
commit
63828096f6
@ -25,6 +25,13 @@ func ExampleInt_SetString() {
|
||||
// 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.
|
||||
|
Loading…
Reference in New Issue
Block a user