Skip to content

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

Merged
Alexays merged 1 commit into
Alexays:masterfrom
layus:pow
Sep 25, 2019
Merged

Add a custom formatter for "pow" numbers.#472
Alexays merged 1 commit into
Alexays:masterfrom
layus:pow

Conversation

@layus

@layus layus commented Sep 24, 2019

Copy link
Copy Markdown
Contributor

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

Alexays commented Sep 25, 2019

Copy link
Copy Markdown
Owner

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

@layus

layus commented Sep 25, 2019

Copy link
Copy Markdown
Contributor Author

Yes, sure !

@layus

layus commented Sep 25, 2019

Copy link
Copy Markdown
Contributor Author

Wiki updated :-)

@Alexays

Alexays commented Sep 25, 2019

Copy link
Copy Markdown
Owner

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
Copy Markdown

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

layus commented Oct 17, 2021

Copy link
Copy Markdown
Contributor Author

@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

layus commented Oct 17, 2021

Copy link
Copy Markdown
Contributor Author

@dschrempf

Copy link
Copy Markdown

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