Is there a way to do accurate floating point division in Python?
Let's say I try to do the following mathematical operations.
- 0.6 / 0.3returns- 2.0which is correct. Cool, it looks like math is working!
- 0.6 / 0.2returns- 2.9999999999999996when- 3.0would be the correct result.
- 0.6 / 0.1returns- 5.999999999999999when- 6.0would be the correct result.
I'm wondering if there is a simple solution to this issue that I'm totally missing?
Note: I have seen the answers for Is floating point math broken? and although many of the answers do an outstanding job of explaining floating point operations, it does not appear that any of the responses provide an actual solution on how to accurately do division with floating point values in Python.
 
    