We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
sum
DESCRIPTION of the request - Make something like sum() but it must actually work for bitmath objects
sum()
Passing an array of bitmath objects into the built-in sum() function has unpredictable results.
In [78]: to_count = [Byte(1), MiB(1), GiB(1)] In [79]: sum(to_count) Out[79]: 3.0 In [80]: bitmath.best_prefix(sum(to_count)) Out[80]: Byte(3.0)
Which is incorrect:
In [76]: counted Out[76]: Byte(1074790401.0) In [77]: counted.best_prefix() Out[77]: GiB(1.0009765634313226)
What you EXPECTED to happen: Expected sum to let bitmath objects use their built in rich comparison and numeric data model emulation methods.
What ACTUALLY happened: sum() seems to be using the instance.value attribute
instance.value
VERSION of bitmath effected (git hashes are OK). Did you install from RPM, PyPi, source?
Add something to bitmath, like bitmath.sum to emulate the standard library function which is misbehaving.
bitmath.sum
The text was updated successfully, but these errors were encountered:
No branches or pull requests
DESCRIPTION of the request - Make something like
sum()
but it must actually work for bitmath objectsPassing an array of bitmath objects into the built-in
sum()
function has unpredictable results.Which is incorrect:
What you EXPECTED to happen:
Expected sum to let bitmath objects use their built in rich comparison and numeric data model emulation methods.
What ACTUALLY happened:
sum()
seems to be using theinstance.value
attributeVERSION of bitmath effected (git hashes are OK). Did you install from RPM, PyPi, source?
To Do
Add something to bitmath, like
bitmath.sum
to emulate the standard library function which is misbehaving.The text was updated successfully, but these errors were encountered: