I am having trouble converting to a decimal float, and then rounding it up. the expected value is not correct.
I will greatly appreciate your help.
from decimal import Decimal, ROUND_HALF_UP
def round_decimal(x):
return x.quantize(Decimal(".01"), rounding=ROUND_HALF_UP)
a=7.1450
b=(Decimal(a))
print (b)
b=7.144999999999999573674358543939888477325439453125
print(round_decimal(Decimal(a) ))
b=7.14 # 7.15 expected