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

Fix fractional numbers in cvt to readable #88

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

mtejada11
Copy link

I've made a fix to the function 'cvt_to_readable' so that it displays fractional values correctly. Before the fix, when the value of 'index' was negative in the case of a small fractional number, for example 0.000001, the suffixes 'K', 'M', 'B', etc. would still be added. With this modification, suffixes such as 'e-003' are added for fractional numbers less than 1.0. Also fixed case where 'index' would result in a value greater than the one corresponding to 'T'.

There was also a spacing inconsistency, for example both '1.24 K' and '12.35K' would be generated for values 1234 and 12345. This was fixed by changing the default format from "5.2f" to ".2f".

The test program has been updated to test for the changes being submitted. Please review and accept this pull request if you wish. I really like termgraph. It's a great command-line utility. Thanks.

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.

1 participant