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

feat: significant figures #117

Closed
privatenumber opened this issue Aug 17, 2020 · 4 comments · Fixed by #127
Closed

feat: significant figures #117

privatenumber opened this issue Aug 17, 2020 · 4 comments · Fixed by #127

Comments

@privatenumber
Copy link

Feature description

Would like to set significant figures on the output value.

So, for example, 1 KB could be outputted as 1.00 KB.

Use case

When I have the values in a right-aligned table, the numbers that end with a 0 are truncated and have different string lengths:
Screen Shot 2020-08-17 at 5 32 23 PM

@ouuan
Copy link

ouuan commented Jun 17, 2021

The pad option is not exactly significant figures. See https://en.wikipedia.org/wiki/Significant_figures#Rounding_to_significant_figures

@avoidwork
Copy link
Owner

I know; significant figures doesn't matter to me for this lib. PR or it'll never land.

@ouuan
Copy link

ouuan commented Jun 17, 2021

I think significant figures do matter. Let's say you want to see 1.34GB instead of 1GB but don't want to see 724.16MB instead of 724MB. For instance, GitHub Releases is using significant figures:

screenshot

If you still think it doesn't matter, I could try drafting a PR.

@avoidwork
Copy link
Owner

Please do, features are driven by other people at this point.

avoidwork added a commit that referenced this issue Jun 30, 2021
Adding test for invalid `precision` value
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 a pull request may close this issue.

3 participants