Skip to content

Conversation

@hugovk
Copy link
Member

@hugovk hugovk commented Sep 29, 2024

Fixes #205.

Avoid the conversion to float where possible.

Python 3.13.0rc2 (v3.13.0rc2:ec610069637, Sep  6 2024, 17:57:29) [Clang 15.0.0 (clang-1500.3.9.4)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> from humanize import filesize
>>> filesize.naturalsize(100_000_000_000_000_000_000_000)
'100.0 ZB'
>>> filesize.naturalsize(1_000_000_000_000_000_000_000_000)
'1.0 YB'
>>> filesize.naturalsize(10_000_000_000_000_000_000_000_000)
'10.0 YB'
>>> filesize.naturalsize(1_000_000_000_000_000_050_331_648)
'1.0 YB'
>>> filesize.naturalsize(1_000_000_000_000_000_050_331_649)
'1.0 YB'

@asmacdo
Copy link

asmacdo commented Sep 29, 2024

Looks good to me, thanks!

@hugovk hugovk changed the title Add passing test cases Fix rollover from ZB to 1.0 YB Sep 30, 2024
@hugovk hugovk merged commit 56b4fa8 into python-humanize:main Oct 1, 2024
@hugovk hugovk deleted the fix-1-YB branch October 1, 2024 11:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

changelog: Fixed For any bug fixes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

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

2 participants