diff options
| author | Ian Lance Taylor <iant@golang.org> | 2024-12-16 15:38:43 -0800 |
|---|---|---|
| committer | Gopher Robot <gobot@golang.org> | 2024-12-17 07:54:13 -0800 |
| commit | 75736cc169631dfaaa48ad46a00e1bf31d830ec8 (patch) | |
| tree | c46455d8670ea3c5bb87faa888373e8d0203427d /src/strconv | |
| parent | 1218566fe5c90e2bd39693566453828e6fbb4c12 (diff) | |
| download | go-75736cc169631dfaaa48ad46a00e1bf31d830ec8.tar.xz | |
fmt, strconv: document that exponent is always two digits
Except for %b where it is only one.
Fixes #70862
Change-Id: Ic423a799b73bfa534f4083f6544bb9cd639fef06
Reviewed-on: https://go-review.googlesource.com/c/go/+/636915
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: David Chase <drchase@google.com>
Reviewed-by: Rob Pike <r@golang.org>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Diffstat (limited to 'src/strconv')
| -rw-r--r-- | src/strconv/ftoa.go | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/src/strconv/ftoa.go b/src/strconv/ftoa.go index 6db0d47e0f..bfe26366e1 100644 --- a/src/strconv/ftoa.go +++ b/src/strconv/ftoa.go @@ -44,6 +44,8 @@ var float64info = floatInfo{52, 11, -1023} // zeros are removed). // The special precision -1 uses the smallest number of digits // necessary such that ParseFloat will return f exactly. +// The exponent is written as a decimal integer; +// for all formats other than 'b', it will be at least two digits. func FormatFloat(f float64, fmt byte, prec, bitSize int) string { return string(genericFtoa(make([]byte, 0, max(prec+4, 24)), f, fmt, prec, bitSize)) } |
