]> Cypherpunks repositories - gostls13.git/commit
runtime: use internal/strconv
authorRuss Cox <rsc@golang.org>
Wed, 29 Oct 2025 02:00:26 +0000 (22:00 -0400)
committerRuss Cox <rsc@golang.org>
Wed, 29 Oct 2025 18:00:23 +0000 (11:00 -0700)
commit9035f7aea538c25a11420bce7cbd8225efc204e7
treeb051053ddcd426a692bbb7181377a52e434f40bf
parent49c1da474d68045458b9462b743e3f0f7dcefdfb
runtime: use internal/strconv

Runtime doing its own number formatting dates back to
when runtime was the bottom-most Go package.
Those days are long gone. Use internal/strconv to avoid
duplicating code and also to get better floating-point
formatting:

% go1.24.6 run x.go
+1.234568e+004
% go run x.go
12345.678
%

With accurate floating point it becomes necessary to
introduce separate printers for float32 vs float64 and
for complex64 vs complex128. Otherwise float32(93.7)
prints as 93.69999694824219.

Change-Id: I25ae3f09519342dc3d1dcabf4711651423e00128
Reviewed-on: https://go-review.googlesource.com/c/go/+/716002
Reviewed-by: David Chase <drchase@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
16 files changed:
src/cmd/compile/internal/typecheck/_builtin/runtime.go
src/cmd/compile/internal/typecheck/builtin.go
src/cmd/compile/internal/walk/builtin.go
src/cmd/internal/goobj/builtinlist.go
src/internal/strconv/ctoa.go
src/runtime/panic_test.go
src/runtime/print.go
test/deferprint.out
test/fixedbugs/bug409.out
test/fixedbugs/issue19658.go
test/fixedbugs/issue35576.out
test/fixedbugs/issue6899.out
test/goprint.out
test/ken/cplx0.out
test/print.out
test/typeparam/typeswitch5.out