3 ms·
round(3) can only round to an integer. Python's round works to an arbitrary decimal position. It would previously scale up, round (ceil/floor really) then scal
by masklinn 7y ago
round(3) can only round to an integer. Python's round works to an arbitrary decimal position.
It would previously scale up, round (ceil/floor really) then scale down. That turned out to induce severe precision issues: https://bugs.python.org/issue1869 https://bugs.python.org/issue1869
- f00zz 7y agoThat's the first thing I'd try, multiply by 10^digits, round, divide by 10^digits. Thanks for the link.