Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

lang.NumFmt Numbers greater than or equal to 5 are not rounded up correctly #7116

Closed
marcjulian opened this issue Apr 1, 2020 · 3 comments · Fixed by #7117
Closed

lang.NumFmt Numbers greater than or equal to 5 are not rounded up correctly #7116

marcjulian opened this issue Apr 1, 2020 · 3 comments · Fixed by #7117
Milestone

Comments

@marcjulian
Copy link

What version of Hugo are you using (hugo version)?

$ hugo version
Hugo Static Site Generator v0.68.3/extended darwin/amd64

Does this issue reproduce with the latest release?

Yes it can be reproduced with the latest release with the following numbers:

{{ lang.NumFmt 2 927.675 }} -> 927.67 (expected 927.68)
{{ lang.NumFmt 2 1927.675 }} -> 1927.67 (expected 1927.68)

{{ lang.NumFmt 2 2927.675 }} -> 2927.68 (as expected)
sams96 added a commit to sams96/hugo that referenced this issue Apr 1, 2020
strconv.FormatFloat doesn't round properly sometimes, this adds a
different method of rounding, fixes gohugoio#7116
@marcjulian
Copy link
Author

$ hugo version
Hugo Static Site Generator v0.69.2/extended darwin/amd64 

Rounding also does not work correctly for the following numbers:

{{ lang.NumFmt 2 535.325 }} -> 535.33 (as expected)
{{ lang.NumFmt 2 3352.825 }} -> 3352.82 (expected 3352.83)

@bep bep added this to the v0.73 milestone Jun 2, 2020
@bep bep added the Bug label Jun 2, 2020
@bep
Copy link
Member

bep commented Jun 2, 2020

/cc @moorereason

@bep bep closed this as completed in #7117 Jun 2, 2020
bep pushed a commit that referenced this issue Jun 2, 2020
strconv.FormatFloat doesn't round properly sometimes, this adds a
different method of rounding, fixes #7116
muenchhausen pushed a commit to muenchhausen/hugo that referenced this issue Jun 24, 2020
strconv.FormatFloat doesn't round properly sometimes, this adds a
different method of rounding, fixes gohugoio#7116
muenchhausen pushed a commit to muenchhausen/hugo that referenced this issue Jun 24, 2020
strconv.FormatFloat doesn't round properly sometimes, this adds a
different method of rounding, fixes gohugoio#7116
@github-actions
Copy link

github-actions bot commented Feb 2, 2022

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Feb 2, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants