mirror of
https://github.com/gohugoio/hugo.git
synced 2025-08-23 21:53:09 +02:00
tpl: Fix bad rounding in NumFmt
strconv.FormatFloat doesn't round properly sometimes, this adds a different method of rounding, fixes #7116
This commit is contained in:
committed by
Bjørn Erik Pedersen
parent
f7d909f394
commit
3d9235e8fc
@@ -29,6 +29,10 @@ func TestNumFormat(t *testing.T) {
|
||||
{0, 12345.6789, "- . ,", "", "12,346"},
|
||||
{11, -12345.6789, "- . ,", "", "-12,345.67890000000"},
|
||||
|
||||
{2, 927.675, "- .", "", "927.68"},
|
||||
{2, 1927.675, "- .", "", "1927.68"},
|
||||
{2, 2927.675, "- .", "", "2927.68"},
|
||||
|
||||
{3, -12345.6789, "- ,", "", "-12345,679"},
|
||||
{6, -12345.6789, "- , .", "", "-12.345,678900"},
|
||||
|
||||
|
Reference in New Issue
Block a user