Wrong rounding with some decimals on round_decimal

Create issue
Issue #1440 new
Anderson Santos created an issue

We are having a problem with wrong Balance Forward which is caused by the rounding on round_decimal function through trunc_decimal.

When trying the function like the following:


instead of rounding it only to 58.90, it's calculating 58.91

that's caused in the line 103 of satchmo_utils/numbers.py


I can't figure out how to improve this line. When I was thinking of writing a testcase for it I found out that there's already a failing test case with this issue but it's commented out on the test suit


I couldn't find the issue regarding this problem, not sure if there's one, but considering this line it's a known issue. Any perspective on solving this problem?

Comments (2)

  1. Alex Zagoro

    i have the same issue. and i also traced it back to this line.


    it's pretty bad, customers get charged extra cent... But i don't think anybody is going to fix it.. :/

  2. Chris Moffitt repo owner

    Could you take a look at replacing the instance of trunc_decimal with round_decimal?

    I think getting rid of trunc_decimal is probably the most sane approach but would appreciate it if some of the people with errors could give that a try.

  3. Log in to comment