package main
import (
"fmt"
"math/big"
)
func main() {
threes := [...]string{"3", "03", "3.", "3.0", "3.00", "3.000"}
for _, three := range threes {
f, b, err := big.ParseFloat(three, 10, 350, big.ToNearestEven)
fmt.Println(three, f, b, err)
fmt.Println(f.Format('b', 350))
}
}
yields
3 3 10 EOF
0p-348
03 3 10 EOF
0p-348
3. 3 10 EOF
0p-348
3.0 3 10 EOF
1720123961992553633708115671476565205597423741876210842803191629540192157066363606052513914832594264915968p-348
3.00 3 10 EOF
1720123961992553633708115671476565205597423741876210842803191629540192157066363606052513914832594264915968p-348
3.000 3 10 EOF
1720123961992553633708115671476565205597423741876210842803191629540192157066363606052513914832594264915968p-348
Something similar is true of gc's constants; see my comments in #7740.