+ 2
Python round method
When I type round(767.87836565, 3) it gives me 767.878000000002. Why and how to neutralize this problem?
1 Resposta
+ 4
Since floating point numbers are based on binary arithmetic (the base 2 method of counting), the result you've obtained is correct from the machine point of view, but is not familiar to what people have in mind commonly. I suggest to consider decimal as a valid alternative. Have a look here: https://docs.python.org/3/library/decimal.html