-
Notifications
You must be signed in to change notification settings - Fork 18.4k
Open
Labels
NeedsInvestigationSomeone must examine and confirm this is a valid issue and not a duplicate of an existing one.Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Milestone
Description
go version devel +926994fd7c Thu Nov 26 21:10:09 2020 +0000 linux/amd64
I was surprised today when I discovered that big.Float.String
truncates to 10 decimal digits of precision, which is surely not a very useful default for a "big" float. I would expect the result to use as many digits of precision as necessary, as if it was using Float.Text('g', -1)
.
Another remark: most types that implement fmt.Stringer
work with the %s
verb. Perhaps big.Float
could do that too, making %s
equivalent to %v
.
The following code prints three different things. I'd expect it to print the same thing three times:
x := big.NewFloat(4.2949672961e+09)
fmt.Printf("%v\n", x)
fmt.Printf("%s\n", x.String())
fmt.Printf("%s\n", x)
mvdan and bassu
Metadata
Metadata
Assignees
Labels
NeedsInvestigationSomeone must examine and confirm this is a valid issue and not a duplicate of an existing one.Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.