[go] strconv: clean up powers-of-10 table, tests

0 views
Skip to first unread message

Russ Cox (Gerrit)

unread,
Oct 22, 2025, 4:50:48 PM (17 hours ago) Oct 22
to Russ Cox, goph...@pubsubhelper.golang.org, golang-...@googlegroups.com, Go LUCI, Alan Donovan, David Chase, golang-co...@googlegroups.com

Russ Cox submitted the change

Change information

Commit message:
strconv: clean up powers-of-10 table, tests

Both Eisel-Lemire and Ryu depend on a table of
truncated 128-bit mantissas of powers of 10,
and so will Dragonbox.

This CL:
- Moves the table to a separate file, so it doesn't look tied to Eisel-Lemire.
- Introduces a uint128 type in math.go for the table values,
since .Hi and .Lo are clearer than [1] and [0].
- Generates the table from a standalone generator pow10gen.go.
- Adds a new pow10 function in math.go to handle table access details.
- Factors a 64x128->192-bit multiply into umul192 in math.go.
- Moves multiplication by log₁₀ 2 and log₂ 10 into math.go.
- Introduces an import_test.go to avoid having to type differently
cased names in test code versus regular code.
- Introduces named constants for the floating-point size parameters.
Previously these were only in the floatInfo global variables.
- Changes the BenchmarkAppendUintVarlen subtest names
to be more useful.
Change-Id: I9826ee5f41c5c19be3b6a7c3c5f277ec6c23b39a
Reviewed-by: Alan Donovan <adon...@google.com>
Reviewed-by: David Chase <drc...@google.com>
Files:
  • M src/strconv/atof.go
  • M src/strconv/atoi_test.go
  • M src/strconv/eisel_lemire.go
  • M src/strconv/export_test.go
  • M src/strconv/ftoa.go
  • M src/strconv/ftoaryu.go
  • D src/strconv/ftoaryu_test.go
  • A src/strconv/import_test.go
  • D src/strconv/internal_test.go
  • M src/strconv/itoa_test.go
  • A src/strconv/math.go
  • A src/strconv/math_test.go
  • A src/strconv/pow10gen.go
  • A src/strconv/pow10tab.go
Change size: XL
Delta: 14 files changed, 1035 insertions(+), 844 deletions(-)
Branch: refs/heads/master
Submit Requirements:
  • requirement satisfiedCode-Review: +2 by David Chase, +2 by Alan Donovan
  • requirement satisfiedTryBots-Pass: LUCI-TryBot-Result+1 by Go LUCI
Open in Gerrit
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: merged
Gerrit-Project: go
Gerrit-Branch: master
Gerrit-Change-Id: I9826ee5f41c5c19be3b6a7c3c5f277ec6c23b39a
Gerrit-Change-Number: 712661
Gerrit-PatchSet: 6
Gerrit-Owner: Russ Cox <r...@golang.org>
Gerrit-Reviewer: Alan Donovan <adon...@google.com>
Gerrit-Reviewer: David Chase <drc...@google.com>
Gerrit-Reviewer: Russ Cox <r...@golang.org>
open
diffy
satisfied_requirement
Reply all
Reply to author
Forward
0 new messages