8000 numfmt: round values if precision is 0 by cakebaker · Pull Request #4089 · uutils/coreutils · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

numfmt: round values if precision is 0 #4089

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

Merged
merged 1 commit into from
Oct 27, 2022

Conversation

cakebaker
Copy link
Contributor

GNU numfmt rounds the result of numfmt --round=from-zero --to-unit=1024 -- 6000 to 6 whereas uutils numfmt doesn't do any rounding in this case and returns 5.859375. The rounding works fine, however, if the precision is > 0, for example, if 6000 is changed to 6000.0 (precision = 1), both tools return 5.9.

This PR fixes this issue and makes the tests round-1, round-1-up, round-1-down, round-1-to-zero, and round-1-near in https://github.com/coreutils/coreutils/blob/master/tests/misc/numfmt.pl pass.

@github-actions
Copy link

GNU testsuite comparison:

GNU test failed: tests/misc/timeout. tests/misc/timeout is passing on 'main'. Maybe you have to rebase?

@sylvestre sylvestre merged commit be5426b into uutils:main Oct 27, 2022
@cakebaker cakebaker deleted the numfmt_rounding branch October 28, 2022 05:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants
0