aboutsummaryrefslogtreecommitdiff
path: root/src/fmt/doc.go
diff options
context:
space:
mode:
authorRuss Cox <rsc@golang.org>2019-01-29 22:13:54 -0500
committerRuss Cox <rsc@golang.org>2019-02-26 05:16:49 +0000
commite1a6d1fc08b2701ac9f67353cb52c51d52877669 (patch)
tree58cd10365ac53e6c5fd06f7ddc49c8e47878e46a /src/fmt/doc.go
parent50bb2b6b0f11e4e3ef73aee55946cd4da546f6b1 (diff)
downloadgo-e1a6d1fc08b2701ac9f67353cb52c51d52877669.tar.xz
fmt: format hex floats and complexes
This CL modifies fmt's printer to implement %x and %X for formatting floating-point data (floats and complexes) in standard hexadecimal notation. See golang.org/design/19308-number-literals for background. For #29008. Vet update is #29986. Change-Id: If2842a11631bc393a1ebcf6914ed07658652af5a Reviewed-on: https://go-review.googlesource.com/c/160245 Reviewed-by: Robert Griesemer <gri@golang.org> Reviewed-by: Rob Pike <r@golang.org>
Diffstat (limited to 'src/fmt/doc.go')
-rw-r--r--src/fmt/doc.go2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/fmt/doc.go b/src/fmt/doc.go
index 3b657f3681..c349f8e321 100644
--- a/src/fmt/doc.go
+++ b/src/fmt/doc.go
@@ -40,6 +40,8 @@
%F synonym for %f
%g %e for large exponents, %f otherwise. Precision is discussed below.
%G %E for large exponents, %F otherwise
+ %x hexadecimal notation (with decimal power of two exponent), e.g. -0x1.23abcp+20
+ %X upper-case hexadecimal notation, e.g. -0X1.23ABCP+20
String and slice of bytes (treated equivalently with these verbs):
%s the uninterpreted bytes of the string or slice
%q a double-quoted string safely escaped with Go syntax