Skip to content

numfmt: --format='%.0f' (precision 0) ignored when scaling with --to #11667

@sylvestre

Description

@sylvestre

Summary

When --to=<scale> is combined with a --format that specifies precision 0 (e.g. %.0f), numfmt still prints one fractional digit. GNU honors the precision.

Found by fuzz_numfmt.

Reproduction

$ LC_ALL=C /usr/bin/numfmt --to=iec --format='%.0f' 5183776
5M

$ target/debug/numfmt --to=iec --format='%.0f' 5183776
5.0M

The precision specifier .0 in --format is ignored; uutils falls back to its default .1f-ish behaviour for scaled output.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions