Skip to content

Commit 9035f7a

Browse files
committed
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>
1 parent 49c1da4 commit 9035f7a

File tree

16 files changed

+379
-421
lines changed

16 files changed

+379
-421
lines changed

src/cmd/compile/internal/typecheck/_builtin/runtime.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,11 +49,13 @@ func goPanicSlice3CU(x uint, y int)
4949
func goPanicSliceConvert(x int, y int)
5050

5151
func printbool(bool)
52-
func printfloat(float64)
52+
func printfloat64(float64)
53+
func printfloat32(float32)
5354
func printint(int64)
5455
func printhex(uint64)
5556
func printuint(uint64)
56-
func printcomplex(complex128)
57+
func printcomplex128(complex128)
58+
func printcomplex64(complex64)
5759
func printstring(string)
5860
func printpointer(any)
5961
func printuintptr(uintptr)

0 commit comments

Comments
 (0)