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

Add a custom formatter for "pow" numbers. #472

Merged
merged 1 commit into from
Sep 25, 2019
Merged

Conversation

layus
Copy link
Contributor

@layus layus commented Sep 24, 2019

This PR is based on #471 just because I worked incrementally.

Instead of providing a pre-formatted string as the value for large
numbers (disk size, network bandwidth), I defined a new format that
accepts =, < and > as modifiers

Example:

format   result
>{}<     >1B<
>{:<}<   >1B     <
>{:>}<   >     1B<
>{:=}<   >1     B<

>{:>}<   > 118Mib/s<
>{:>}<   >11.8Mib/s<
>{:>}<   >1.18Mib/s<
>{:>}<   > 121kib/s<

>{:>}<   > 123Mb/s<
>{:>}<   >12.3Mb/s<
>{:>}<   >1.23Mb/s<
>{:>}<   > 123kb/s<

@Alexays
Copy link
Owner

Alexays commented Sep 25, 2019

Could you also rebase this PR, and update the wiki for the disk module on github? ❤️

@layus
Copy link
Contributor Author

layus commented Sep 25, 2019

Yes, sure !

@layus
Copy link
Contributor Author

layus commented Sep 25, 2019

Wiki updated :-)

@Alexays
Copy link
Owner

Alexays commented Sep 25, 2019

Thanks a lot ❤️

@Alexays Alexays merged commit 3131eb0 into Alexays:master Sep 25, 2019
@layus layus mentioned this pull request Jul 23, 2020
@dschrempf
Copy link

Just saw this thread and, wow, thank you! I did NOT find this in the Wiki! Maybe it could be promoted a bit more!

@layus
Copy link
Contributor Author

layus commented Oct 17, 2021

@dschrempf To be honnest, the feature still has some bugs where a stray "e" sometimes appears where it should not. Rounding errors ? Some float artifact ?

Just saw this thread and, wow, thank you! I did NOT find this in the Wiki! Maybe it could be promoted a bit more!

I would be glad to make changes. Could you tell me where you searched for that information ? It would help even more if you could make yourself a fix that matches your search.

Anyway, glad that I was useful to at least one person :-).

@layus
Copy link
Contributor Author

layus commented Oct 17, 2021

@dschrempf
Copy link

Thank you, this is very accessible and also clear!

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.

3 participants