Skip to content

fix: use IEC prefixes (Ki, Mi, Gi) for base-1024 size display#571

Open
ChihebBENCHEIKH1 wants to merge 1 commit intobootandy:masterfrom
ChihebBENCHEIKH1:fix/iec-unit-prefixes
Open

fix: use IEC prefixes (Ki, Mi, Gi) for base-1024 size display#571
ChihebBENCHEIKH1 wants to merge 1 commit intobootandy:masterfrom
ChihebBENCHEIKH1:fix/iec-unit-prefixes

Conversation

@ChihebBENCHEIKH1
Copy link
Copy Markdown

Closes #570

dust calculates sizes using base-1024 (binary/IEC) by default but displays them with SI prefixes (K, M, G), which is misleading since SI prefixes imply powers of 1000.

Before: 1.0M (ambiguous — is this 1,000,000 or 1,048,576 bytes?)
After: 1.0Mi (clearly 1,048,576 bytes, base-1024)

SI mode (-o si) continues using K, M, G with base-1000 as expected.

Changes:

  • Replaced single UNITS array with SI_UNITS and IEC_UNITS
  • human_readable_number() and get_number_format() now select the correct suffix based on the output format
  • Updated all unit and integration tests

…dy#570)

dust was calculating sizes using base-1024 (IEC) but displaying them
with SI prefixes (K, M, G). This is misleading since SI prefixes imply
powers of 1000.

Now base-1024 values use proper IEC prefixes (Ki, Mi, Gi, Ti, Pi) and
base-1000 values (via -o si) continue using SI prefixes (K, M, G, T, P).
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.

dust shows IEC values with SI prefixes

1 participant