-
Notifications
You must be signed in to change notification settings - Fork 18.7k
Closed
Labels
DocumentationIssues describing a change to documentation.Issues describing a change to documentation.FrozenDueToAgeNeedsFixThe path to resolution is known, but the work has not been done.The path to resolution is known, but the work has not been done.help wanted
Milestone
Description
What version of Go are you using (go version)?
go version go1.10.1 linux/amd64
Does this issue reproduce with the latest release?
Yes
What operating system and processor architecture are you using (go env)?
GOARCH="amd64"
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOOS="linux"
What did you do?
fmt.Println(strconv.FormatFloat(1.5, 'g', 6, 64))
https://play.golang.org/p/WRHc89mjuSG
What did you expect to see?
1.50000
https://golang.org/pkg/strconv/#FormatFloat says:
The precision prec controls the number of digits […]. For 'g' and 'G' it is the total number of digits.
I gave prec=6, so the total number of digits should be 6.
What did you see instead?
1.5
The total number of digits is 2.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
DocumentationIssues describing a change to documentation.Issues describing a change to documentation.FrozenDueToAgeNeedsFixThe path to resolution is known, but the work has not been done.The path to resolution is known, but the work has not been done.help wanted