Commit 834fda37 authored by Stefan Nilsson's avatar Stefan Nilsson Committed by Robert Griesemer

atof: added 'E' as valid token for exponent

R=golang-dev, gri
CC=golang-dev
https://golang.org/cl/3827042
parent 33145c48
......@@ -107,7 +107,7 @@ func stringToDecimal(s string) (neg bool, d *decimal, trunc bool, ok bool) {
// 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
......
......@@ -24,6 +24,7 @@ var atoftests = []atofTest{
{"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},
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment