mirror of
https://github.com/golang/go
synced 2024-11-24 21:10:04 -07:00
atof: added 'E' as valid token for exponent
R=golang-dev, gri CC=golang-dev https://golang.org/cl/3827042
This commit is contained in:
parent
33145c4868
commit
834fda37c5
@ -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},
|
||||
|
Loading…
Reference in New Issue
Block a user