mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
strconv: fix %.2g, 40
Fixes #845. R=rsc CC=golang-dev https://golang.org/cl/1673049
This commit is contained in:
parent
1246ad8390
commit
21f8ae8fec
2 changed files with 21 additions and 4 deletions
|
|
@ -34,6 +34,17 @@ var ftoatests = []ftoaTest{
|
|||
ftoaTest{200000, 'g', -1, "200000"},
|
||||
ftoaTest{2000000, 'g', -1, "2e+06"},
|
||||
|
||||
// g conversion and zero suppression
|
||||
ftoaTest{400, 'g', 2, "4e+02"},
|
||||
ftoaTest{40, 'g', 2, "40"},
|
||||
ftoaTest{4, 'g', 2, "4"},
|
||||
ftoaTest{.4, 'g', 2, "0.4"},
|
||||
ftoaTest{.04, 'g', 2, "0.04"},
|
||||
ftoaTest{.004, 'g', 2, "0.004"},
|
||||
ftoaTest{.0004, 'g', 2, "0.0004"},
|
||||
ftoaTest{.00004, 'g', 2, "4e-05"},
|
||||
ftoaTest{.000004, 'g', 2, "4e-06"},
|
||||
|
||||
ftoaTest{0, 'e', 5, "0.00000e+00"},
|
||||
ftoaTest{0, 'f', 5, "0.00000"},
|
||||
ftoaTest{0, 'g', 5, "0"},
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue