-
-
Notifications
You must be signed in to change notification settings - Fork 80
Closed
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
Labels
No labels