diff options
author | ian <ian@138bc75d-0d04-0410-961f-82ee72b054a4> | 2012-03-02 16:38:43 +0000 |
---|---|---|
committer | ian <ian@138bc75d-0d04-0410-961f-82ee72b054a4> | 2012-03-02 16:38:43 +0000 |
commit | 2d2d80b8bd963f59534897b3d51ef8bd546cb4bc (patch) | |
tree | efa0c55763b34cbc633bc494c2743d1b5d9aaff3 /libgo/go/strconv/atof.go | |
parent | 2ad2700dbf70b2e49575f3f2307839a45cf2f71c (diff) | |
download | gcc-2d2d80b8bd963f59534897b3d51ef8bd546cb4bc.tar.gz |
libgo: Update to weekly.2012-02-14 release.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@184798 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libgo/go/strconv/atof.go')
-rw-r--r-- | libgo/go/strconv/atof.go | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/libgo/go/strconv/atof.go b/libgo/go/strconv/atof.go index 42fc431db8a..cd3031b0e61 100644 --- a/libgo/go/strconv/atof.go +++ b/libgo/go/strconv/atof.go @@ -52,10 +52,10 @@ func special(s string) (f float64, ok bool) { return } -// TODO(rsc): Better truncation handling. func (b *decimal) set(s string) (ok bool) { i := 0 b.neg = false + b.trunc = false // optional sign if i >= len(s) { @@ -88,8 +88,12 @@ func (b *decimal) set(s string) (ok bool) { b.dp-- continue } - b.d[b.nd] = s[i] - b.nd++ + if b.nd < len(b.d) { + b.d[b.nd] = s[i] + b.nd++ + } else if s[i] != '0' { + b.trunc = true + } continue } break |