Skip to content

format_bytes_for_user prints KB/MB/GB for base-1024 math #190

Closed

Description

@rominf

Problem

format_bytes_for_user (apps/rocm/src/main.rs) divides by 1024 but labels the result KB, MB, GB. The units say base 1000; the arithmetic is base 1024, so every figure it prints is mislabelled.

format_bytes, used by rocm storage, does the same arithmetic and prints KiB, MiB, GiB. Two size formatters with the same maths and different units now both appear in user-facing output.

Suggested direction

Pick one and use it everywhere: either correct the units on format_bytes_for_user to the Ki/Mi/Gi forms, or make it genuinely base 1000. Then collapse the two functions so there is a single size formatter.

Context

Out of scope for #172, which only made format_bytes live and fixed its rounding at unit boundaries. format_bytes_for_user reaches unrelated call sites, so changing its output belongs in its own change. Raised from review feedback on that PR.

Activity

  1. added 5 commits that reference this issue on Oct 14, 2026
    f308121
    b960bbb
    3629969
    037287c
    d4e7c75
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions