Repository navigation
Add --decimals option to the convert command - #160
Merged
codepiyusss merged 1 commit intoNov 21, 2026
Merged
codepiyusss merged 1 commit into
codepiyusss merged 1 commit into
Conversation
codepiyusss
approved these changes
Nov 21, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #77
What
Adds a
--decimalsoption (typeint, default2) tofixit convert. The result is printed asround(result, decimals).Why
fixit convert 100 f2cprinted37.77777777777778with no way to control rounding.Changes
fixit/cli.py: new--decimalsargument on theconvertsubparser;run_convertprintsround(result, args.decimals).tests/test_cli.py: tests for the default (37.78),--decimals 4(37.7778), and a whole result keeping its trailing zero (212.0for100 c2f).Note: the default output of
f2cchanges from full precision to two decimals, as the issue asks.Testing
python -m pytest tests/test_cli.py -k convert -q: 5 passedpython -m pytest -q: 127 passedRegression test: untested: a small feature has no test that fails before the change
Fixes #77