It seems that the rabbit hole goes deeper. Neither algorithm works. Accounting does not follow IEEE rounding rules - they resort to something called "banker's rounding" which is implemented in Python's decimal (and Java's BigDecimal) as ROUND_HALF_EVEN.
In Brazil (and I suppose in other countries too) our standard's body enforce such rounding mode everywhere.
I'm also for using Python decimal for rounding. Nevertheless, there's an algorithm (in C++) for implementing banker's rounding for float types in http://www.cplusplus.com/forum/articles/3638/
It seems that the rabbit hole goes deeper. Neither algorithm works. Accounting does not follow IEEE rounding rules - they resort to something called "banker's rounding" which is implemented in Python's decimal (and Java's BigDecimal) as ROUND_HALF_EVEN.
In Brazil (and I suppose in other countries too) our standard's body enforce such rounding mode everywhere.
I'm also for using Python decimal for rounding. Nevertheless, there's an algorithm (in C++) for implementing banker's rounding for float types in http:// www.cplusplus. com/forum/ articles/ 3638/