]> Cypherpunks repositories - gostls13.git/commit
internal/strconv: fix pow10 off-by-one in exponent result
authorRuss Cox <rsc@golang.org>
Sun, 2 Nov 2025 03:26:17 +0000 (23:26 -0400)
committerGopher Robot <gobot@golang.org>
Tue, 4 Nov 2025 04:09:12 +0000 (20:09 -0800)
commit9795c7ba220702c8bbf0188a8fc28e1d482bae4f
tree4f411fe59a91875bb8561749073f06b0a3f89160
parentad5e941a4559a402fa3f428e612c58ec86471517
internal/strconv: fix pow10 off-by-one in exponent result

The exact meaning of pow10 was not defined nor tested directly.
Define it as pow10(e) returns mant, exp where mant/2^128 * 2**exp = 10^e.
This is the most natural definition but is off-by-one from what
it had been returning. Fix the off-by-one and then adjust the
call sites to stop compensating for it.

Change-Id: I9ee475854f30be4bd0d4f4d770a6b12ec68281fe
Reviewed-on: https://go-review.googlesource.com/c/go/+/717180
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Alan Donovan <adonovan@google.com>
Auto-Submit: Russ Cox <rsc@golang.org>
src/internal/strconv/atofeisel.go
src/internal/strconv/export_test.go
src/internal/strconv/ftoaryu.go
src/internal/strconv/import_test.go
src/internal/strconv/math.go
src/internal/strconv/math_test.go