bitmath
bitmath copied to clipboard
Why not represent bit count as integer?
Hi,
I find this a bit unintuitive:
>>> bitmath.KiB(1/3).to_Bit()
Bit(2730.6666666666665)
I would expect this to throw an exception (I did not specify an integer count of bytes).
There seems to be a precision of 12 decimals, but a bit is non-divisible. So 0.666 bit is not a quantity of bits which can exist.
What is the purpose of using floating point sizes in bitmath, when you could represent bit count as an integer everywhere?
I think the best solution will be to math.floor()
results from division.
Things being a float by default is more of a core design choice I made forever ago that I need to look at again a lot more closely.