-
-
Notifications
You must be signed in to change notification settings - Fork 3
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
Uniform printed decimals #6
Comments
Humm, it is actually by design, the less visual clutter the better I thought. But yeah, I do understand the need to maybe align things up.
or
Wouldn't it work for you? |
I agree with you in absolute terms. The problem is that I'm displaying 5 of these in a row, and the variation makes it difficult to parse—you literally have to chase the decimal point in each number. Alignment (see any scientific paper) happens on the decimal point, so 3.0MB and 355.0MB are aligned, as well as 3.00MB and 355.67GB, but 35MB and 255.8MB are not. I understand these are very personal decisions. I'm porting some Java software and there I was just using the standard APIs, in which you can specify the exact number of decimals (and a thousands separator). |
I don't think any standard API would be able to generate human representations, including SI prefixes and rounding adequately. Rust has a standard API capable of printing fixed decimal points, pretty much like the Java one. Anyway, I'll think about it, even though I think it is kinda out of this crate's scope. |
What I meant is that I was choosing the correct SI or binary unit (it's completely trivial, as you know) and then let the Java API print exactly 2 decimals and handling the commas. |
I see, you were finding the SI prefix by yourself, as, sure, it is trivial. In fact, in addition to thinking if it does fit the crate concept, fixed precision is not that simple here because of the engine that avoids generating .0 and .00 in the first place. I'm still going to think about it, even if it does not interest you anymore. |
What I mean is that saving five additional lines of code is not worth the trouble of changing your design. You are trying to solve a different problem than I am. |
It is done. The 2.0 version will include a new Representation system, so users can customize the output however they like, including fixed precision. |
I'm having a slight aesthetics problem—when the second decimal is zero it is not printed, as in
Would it be possible to fix the number of decimal digits so that they are the same no matter what they are? That would help with alignment, tables, etc.
The text was updated successfully, but these errors were encountered: