Actually, the explanation is a little further down in the docs,
specifically, this paragraph:
For floating-point values, width sets the minimum width of the field and
precision sets the number of places after the decimal, if appropriate,
except that for %g/%G precision sets the total number of
Thanks, issue filed.
https://github.com/golang/go/issues/18772
On Tuesday, January 24, 2017 at 2:13:15 PM UTC+1, Axel Wagner wrote:
>
> FWIW, this is the code used for formatting:
> https://golang.org/src/strconv/ftoa.go#L54
> I would claim, this difference (and/or its conflict with the
> documen
FWIW, this is the code used for formatting:
https://golang.org/src/strconv/ftoa.go#L54
I would claim, this difference (and/or its conflict with the documentation)
is a bug.
On Tue, Jan 24, 2017 at 2:10 PM, Axel Wagner
wrote:
> Hm, after some more consideration, this isn't really a good explanati
Hm, after some more consideration, this isn't really a good explanation;
%g, in conflict with the documentation, behaves differently then *both* %e
and %f in this case: https://play.golang.org/p/LEVTU7r4wX
On Tue, Jan 24, 2017 at 2:03 PM, Axel Wagner
wrote:
> Because the default-format for float
I see. So why does %g produce a different number than %f?
On Tuesday, January 24, 2017 at 2:03:58 PM UTC+1, Axel Wagner wrote:
>
> Because the default-format for floats is %g, not %f:
> https://play.golang.org/p/KZBtA3ZVN3
> (documented in the fmt-godoc: https://godoc.org/fmt -- search for
> "de
Because the default-format for floats is %g, not %f:
https://play.golang.org/p/KZBtA3ZVN3
(documented in the fmt-godoc: https://godoc.org/fmt -- search for "default
format")
On Tue, Jan 24, 2017 at 2:00 PM, Vedran Vekic
wrote:
> https://play.golang.org/p/-gSNqKZlst
>
> --
> You received this mes
https://play.golang.org/p/-gSNqKZlst
--
You received this message because you are subscribed to the Google Groups
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to golang-nuts+unsubscr...@googlegroups.com.
For more options, visit https://gro