math/big: Float.String inconsistent with format %v #42887
Labels
NeedsInvestigation
Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Milestone
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 usingFloat.Text('g', -1)
.Another remark: most types that implement
fmt.Stringer
work with the%s
verb. Perhapsbig.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:
The text was updated successfully, but these errors were encountered: