1

I'm using Odoo 10 and I have met some rounding issue with calculation using Python. For example: My formula is:

a = 224.689511
b = 195.382186
c = 1000

return round((a - b) * c, 2)

The return value is 29307.32 But the correct value is 29307.33

Value before rounding is 29307.324999999997 but it should be 29307.325

Is there any solution for this kind of case?

Suparjito
  • 11
  • 2

1 Answers1

0

29307.325 rounds up to 29307.33, since you want only 2 decimal places

Ishan Joshi
  • 487
  • 3
  • 7
  • Yes. That's what I want. But if you run my code above, it actually return 29307.32. Because the actual value before rounding is 29307.324999999997 – Suparjito Sep 27 '19 at 09:04