atof: added 'E' as valid token for exponent
R=golang-dev, gri
CC=golang-dev
https://golang.org/cl/3827042
diff --git a/src/pkg/strconv/atof.go b/src/pkg/strconv/atof.go
index 90ca7c4..bcb138f 100644
--- a/src/pkg/strconv/atof.go
+++ b/src/pkg/strconv/atof.go
@@ -107,7 +107,7 @@
// just be sure to move the decimal point by
// a lot (say, 100000). it doesn't matter if it's
// not the exact number.
- if i < len(s) && s[i] == 'e' {
+ if i < len(s) && (s[i] == 'e' || s[i] == 'E') {
i++
if i >= len(s) {
return
diff --git a/src/pkg/strconv/atof_test.go b/src/pkg/strconv/atof_test.go
index 2277ff6..68c50bf 100644
--- a/src/pkg/strconv/atof_test.go
+++ b/src/pkg/strconv/atof_test.go
@@ -24,6 +24,7 @@
{"1x", "0", os.EINVAL},
{"1.1.", "0", os.EINVAL},
{"1e23", "1e+23", nil},
+ {"1E23", "1e+23", nil},
{"100000000000000000000000", "1e+23", nil},
{"1e-100", "1e-100", nil},
{"123456700", "1.234567e+08", nil},