+ 1
Why is final_price = price *1.07 different from final_price = price *107/100
Was doing the ballpark orders problem using python. My code worked in first two cases, but hidden cases failed. A Google search found this as a possible fix and sure enough it now passed. It must be a rounding issue?
3 Answers
+ 2
Yep. Rounding error.
Even though BODMAS/PEMDAS says it shouldn't matter, it does. Seems that division causes rounding issues when performed anywhere except last.
I think I had to add the tax to the total separately to pass test case #5.
+ 1
Wierd. Thank you.
0
It confuse me now.
and I also curious about how to google it.
thanks