4 ms·
That's what round(3) is for
by f00zz 7y ago
That's what round(3) is for
- masklinn 7y agoround(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.