I tried the following computation in python:
>>> 12.2 / 0.2
60.99999999999999
it's obviously that i开发者_如何学JAVAt didn't return the exact answer.
According to the answers in text, l have known that we can use decimal.Decimal
to obtain accurate calculation。 But I'm confused that if I have to use decimal.Decimal
every time in my project to obtain exact results, is there any other method to ensure obtaining exact results in practice?
精彩评论