Skip to content

Suggestion: significant_digits as alternative to decimal_places #36

@cederberg

Description

@cederberg

Sometimes I find it useful to print values with a minimum number of significant digits, instead of locking the number of decimals used. For example, when printing a system memory summary:

3.1 GiB (61.2%) free ∙ 677.1 MiB rss ∙ 1.3 GiB cache ∙ 5.1 GiB total

It is slightly easier to read when a minimum of two significant digits are used, instead of locking the number of decimals to 1:

3.1 GiB (61.2%) free ∙ 677 MiB rss ∙ 1.3 GiB cache ∙ 5.1 GiB total

Would this be an interesting addition to the library?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions