]> Cypherpunks repositories - gostls13.git/commit
fmt: document how %#g handles infinities and NaNs
authorRob Pike <r@golang.org>
Sun, 21 Jan 2024 06:20:02 +0000 (17:20 +1100)
committerRob Pike <r@golang.org>
Tue, 13 Feb 2024 01:04:30 +0000 (01:04 +0000)
commit36fb6160ae128489c4fd793d7359370ea3eaf992
treecb5e06287491d9a77a8e461d76af1070a46fbdcf
parente45c262fe55ada091a4ae53bf140ff22d9f74b35
fmt: document how %#g handles infinities and NaNs

The %#g format prints a "Go-syntax representation", but there is
no such thing for IEEE754 infinities and NaNs, so just document
what happens, which is that it prints +Inf, -Inf, or NaN.  We could
show something like math.Inf(1) and math.Nan(), but that doesn't
sit right, and anyway for NaNs you can't even recover the original
value. Simpler and more honest to give up.

Fixes #51486

Change-Id: I8d4e8186f5d7acc3e0e7b51d0b322142908ea0a2
Reviewed-on: https://go-review.googlesource.com/c/go/+/557235
Run-TryBot: Rob Pike <r@golang.org>
Reviewed-by: Russ Cox <rsc@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@google.com>
src/fmt/doc.go