diff options
Diffstat (limited to 'src/math/big/example_test.go')
| -rw-r--r-- | src/math/big/example_test.go | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/src/math/big/example_test.go b/src/math/big/example_test.go index ac7955219d..cfc77351d4 100644 --- a/src/math/big/example_test.go +++ b/src/math/big/example_test.go @@ -51,6 +51,19 @@ func ExampleInt_Scan() { // Output: 18446744073709551617 } +func ExampleFloat_Scan() { + // The Scan function is rarely used directly; + // the fmt package recognizes it as an implementation of fmt.Scanner. + f := new(big.Float) + _, err := fmt.Sscan("1.19282e99", f) + if err != nil { + log.Println("error scanning value:", err) + } else { + fmt.Println(f) + } + // Output: 1.19282e+99 +} + // This example demonstrates how to use big.Int to compute the smallest // Fibonacci number with 100 decimal digits and to test whether it is prime. func Example_fibonacci() { |
