-
-
Notifications
You must be signed in to change notification settings - Fork 97
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
Feature request: significant figures #132
Comments
To clarify, you're asking to drop the trailing zeros that'd come from My understanding of a significant figure is based on resolution, which is done with
from https://en.wikipedia.org/wiki/Significant_figures So, could you explain what you're after exactly? |
I want |
So you have that today, minus dropping trailing zeros because they are significant. |
I'm not sure how I could attempt to run I think you'd do this by exporting the 'object' option and running another function against the Number. The GH example is a precision of 3, and relies on the unit changing to keep the formatting user friendly. |
I think it's easy to have significant figures itself, but there are many other options and I'm not sure how to deal with the relationship between significant figures and other options. |
I think you're misusing that phrase. You have significant figures by definition right now with 'round' option; I think you're asking for something else entirely with a specific precision on the result, which would be a tail op before the returns. |
See https://en.wikipedia.org/wiki/Significant_figures#Rounding_to_significant_figures The |
This is on the same page. What I'm trying to point out is you need to both specify the round variable, and then your ask/want is to run precision on the result. There's an edge case when you have numbers that would use an exponent larger than 8. |
This is also something I want to point out; there is literally no way for the function to know what's significant, so this is a configuration variable. I fail to see how your use case can't be handled right now by using a different output or simply composing filesize with another function that does whatever you want. |
Then you can simply use a piece of code to tell me how. |
OK, I just realized that it's not hard. Just run function on the number part of the output. However, this library itself is not hard to implement if there are't so many options. It will be better if it's available out-of-box in this library. In fact, I think rounding to three significant figures should be the default behavior. If the significant figures feature is hard to be added within this library, I can use the workaround to process the output on the user side. |
I think it can be done in the lib, the point to execute the precision is on the |
I implemented it such that if the exponent is > 8 & precision > 0 the precision will be adjusted such that it'll add the difference such that the output is an integer of full size... the purpose of this lib overrides the strictness of this option. |
Thanks for implementing this. I'm now using the precision option alone and it works fine. |
rtfm |
This was requested in #117, which was closed by #127 that provides padding instead of significant figures.
Significant figures are useful. Let's say you want to see
1.34GB
instead of1GB
but don't want to see724.16MB
instead of724MB
.For instance, GitHub Releases is using significant figures:
I open this issue because #117 is closed. A new issue is good for tracking its status and making potential contributors aware of it.
I know we need a PR or there won't be this feature, so I'm not requesting the maintainer to provide this feature :)
The text was updated successfully, but these errors were encountered: