You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
naturalsize() truncates non-integer byte counts below the base ("1 Bytes") #459
From 1 kB upwards the fraction is kept using format, but below the base the value is truncated with int(). The singular check also compares the untruncated value with 1, so 1.5 is shown as "1 Bytes".
In #239 you mentioned that "1.1 Bytes" would be better than "1 Bytes" for non-integer input, and that tests for non-integer input were missing.
Proposal:
Format non-integer values below the base with format, like larger units (e.g. "1.5 Bytes", and "1.5B" with gnu=True).
I'd like to contribute a fix for this issue. I'll add regression tests for fractional byte values while preserving the existing behavior for integer inputs. Is the proposed output format acceptable?
Thanks for your interest, @manshi-n! Our team (the issue author) is already working on this one, so we'd prefer to keep it on our side to avoid duplicate PRs. We'd be very happy to have your review once the PR is up.
Activity
manshi-n commentedon Oct 20, 2026
I'd like to contribute a fix for this issue. I'll add regression tests for fractional byte values while preserving the existing behavior for integer inputs. Is the proposed output format acceptable?
uvrvuoon commentedon Oct 21, 2026
Thanks for your interest, @manshi-n! Our team (the issue author) is already working on this one, so we'd prefer to keep it on our side to avoid duplicate PRs. We'd be very happy to have your review once the PR is up.