FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Decimal filesize YB to ZB rollover doesn't happen where expected · Issue #205 · python-humanize/humanize · GitHub

Decimal filesize YB to ZB rollover doesn't happen where expected #205

Description

For all smaller units, we never see 1000, it always rolls over to the next.

What did you do?

In [5]: from humanize import filesize
In [6]: filesize.naturalsize(100_000_000_000_000_000_000_000)
Out[6]: '100.0 ZB'

In [7]: filesize.naturalsize(1_000_000_000_000_000_000_000_000)
Out[7]: '1000.0 ZB'

In [8]: filesize.naturalsize(10_000_000_000_000_000_000_000_000)
Out[8]: '10.0 YB'

The exact rollover happens here:

In [66]: filesize.naturalsize(1_000_000_000_000_000_050_331_648)
Out[66]: '1000.0 ZB'

In [67]: filesize.naturalsize(1_000_000_000_000_000_050_331_649)
Out[67]: '1.0 YB'

What did you expect to happen?

Id expect to see 1 YB rather than 1000 ZB.

What versions are you using?

  • OS: 6.10.9-200.fc40.x86_64 (Fedora 40)
  • Python: 3.11.5
  • Humanize: 4.10.0

I assume this is just a floating point precision limitation, so probably no fix is needed.

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


    Back | FazBrowse Home | New Git URL