diff options
author | Ian Lance Taylor <iant@golang.org> | 2019-09-06 18:12:46 +0000 |
---|---|---|
committer | Ian Lance Taylor <ian@gcc.gnu.org> | 2019-09-06 18:12:46 +0000 |
commit | aa8901e9bb0399d2c16f988ba2fe46eb0c0c5d13 (patch) | |
tree | 7e63b06d1eec92beec6997c9d3ab47a5d6a835be /libgo/go/strconv/example_test.go | |
parent | 920ea3b8ba3164b61ac9490dfdfceb6936eda6dd (diff) | |
download | gcc-aa8901e9bb0399d2c16f988ba2fe46eb0c0c5d13.zip gcc-aa8901e9bb0399d2c16f988ba2fe46eb0c0c5d13.tar.gz gcc-aa8901e9bb0399d2c16f988ba2fe46eb0c0c5d13.tar.bz2 |
libgo: update to Go 1.13beta1 release
Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/193497
From-SVN: r275473
Diffstat (limited to 'libgo/go/strconv/example_test.go')
-rw-r--r-- | libgo/go/strconv/example_test.go | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/libgo/go/strconv/example_test.go b/libgo/go/strconv/example_test.go index 2d1a2a9..50f6b20 100644 --- a/libgo/go/strconv/example_test.go +++ b/libgo/go/strconv/example_test.go @@ -222,10 +222,39 @@ func ExampleParseFloat() { if s, err := strconv.ParseFloat(v, 64); err == nil { fmt.Printf("%T, %v\n", s, s) } + if s, err := strconv.ParseFloat("NaN", 32); err == nil { + fmt.Printf("%T, %v\n", s, s) + } + // ParseFloat is case insensitive + if s, err := strconv.ParseFloat("nan", 32); err == nil { + fmt.Printf("%T, %v\n", s, s) + } + if s, err := strconv.ParseFloat("inf", 32); err == nil { + fmt.Printf("%T, %v\n", s, s) + } + if s, err := strconv.ParseFloat("+Inf", 32); err == nil { + fmt.Printf("%T, %v\n", s, s) + } + if s, err := strconv.ParseFloat("-Inf", 32); err == nil { + fmt.Printf("%T, %v\n", s, s) + } + if s, err := strconv.ParseFloat("-0", 32); err == nil { + fmt.Printf("%T, %v\n", s, s) + } + if s, err := strconv.ParseFloat("+0", 32); err == nil { + fmt.Printf("%T, %v\n", s, s) + } // Output: // float64, 3.1415927410125732 // float64, 3.1415926535 + // float64, NaN + // float64, NaN + // float64, +Inf + // float64, +Inf + // float64, -Inf + // float64, -0 + // float64, 0 } func ExampleParseInt() { |