Last active
October 26, 2021 22:47
-
-
Save bodedra/6dd95f7e6fc734cbda2da45a7f55343f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#python 3.x | |
import decimal | |
ctx = decimal.getcontext() | |
ctx.rounding = decimal.ROUND_HALF_UP | |
payment_discount = round((decimal.Decimal(amount * line.discount)/decimal.Decimal(100.0)), 2) | |
float(payment_discount) | |
amount = 611.50 | |
discount = 10 | |
before payment_discount = 61.1 | |
after round half up = payment_discount = 61.11 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment