Hacker News new | ask | show | jobs
by f00zz 2490 days ago
That's what round(3) is for
1 comments

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

That's the first thing I'd try, multiply by 10^digits, round, divide by 10^digits. Thanks for the link.