Skip to content

Commit 9e1c864

Browse files
committed
doc/go1.13: document fmt's number syntax updates
Fixes #32815 Change-Id: Ia8ac9943a920a056ba7dbc69c1c70fa188f7aca8 Reviewed-on: https://go-review.googlesource.com/c/go/+/191578 Reviewed-by: Robert Griesemer <[email protected]>
1 parent e684129 commit 9e1c864

File tree

2 files changed

+19
-1
lines changed

2 files changed

+19
-1
lines changed

doc/go1.13.html

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -667,6 +667,24 @@ <h3 id="minor_library_changes">Minor changes to the library</h3>
667667

668668
<dl id="fmt"><dt><a href="/pkg/fmt/">fmt</a></dt>
669669
<dd>
670+
<!-- CL 160245 -->
671+
<p>
672+
The printing verbs <code>%x</code> and <code>%X</code> now format floating-point and
673+
complex numbers in hexadecimal notation, in lower-case and upper-case respectively.
674+
</p>
675+
676+
<!-- CL 160246 -->
677+
<p>
678+
The new printing verb <code>%O</code> formats integers in base 8, emitting the <code>0o</code> prefix.
679+
</p>
680+
681+
<!-- CL 160247 -->
682+
<p>
683+
The scanner now accepts hexadecimal floating-point values, digit-separating underscores
684+
and leading <code>0b</code> and <code>0o</code> prefixes.
685+
See the <a href="#language">Changes to the language</a> for details.
686+
</p>
687+
670688
<!-- CL 176998 -->
671689
<p>The <a href="/pkg/fmt/#Errorf"><code>Errorf</code></a> function
672690
has a new verb, <code>%w</code>, whose operand must be an error.

src/fmt/scan.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -609,7 +609,7 @@ func (s *ss) scanRune(bitSize int) int64 {
609609
return r
610610
}
611611

612-
// scanBasePrefix reports whether the integer begins with a bas prefix
612+
// scanBasePrefix reports whether the integer begins with a base prefix
613613
// and returns the base, digit string, and whether a zero was found.
614614
// It is called only if the verb is %v.
615615
func (s *ss) scanBasePrefix() (base int, digits string, zeroFound bool) {

0 commit comments

Comments
 (0)