]> Cypherpunks repositories - gostls13.git/commit
strconv: fix for parseFloatPrefix
authorRobert Griesemer <gri@golang.org>
Thu, 30 Apr 2020 20:24:05 +0000 (13:24 -0700)
committerRobert Griesemer <gri@golang.org>
Thu, 30 Apr 2020 21:34:51 +0000 (21:34 +0000)
commit8740bdc5afd07cf62722907644f65411cc52fa1c
tree05eeb98fc8c88ffa3764190cc1223de7eb10c617
parent0f8fecaba762c352db481d4919edf404f5590d22
strconv: fix for parseFloatPrefix

parseFloatPrefix accepts a string if it has a valid floating-point
number as prefix. Make sure that "infi", "infin", ... etc. are
accepted as valid numbers "inf" with suffix "i", "in", etc. This
is important for parsing complex numbers such as "0+infi".

This change does not affect the correctness of ParseFloat because
ParseFloat rejects strings that contain a suffix after a valid
floating-point number.

Updates #36771.

Change-Id: Ie1693a8ca2f8edf07b57688e0b35751b7100d39d
Reviewed-on: https://go-review.googlesource.com/c/go/+/231237
Run-TryBot: Robert Griesemer <gri@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
src/strconv/atof.go
src/strconv/atof_test.go