1

For the following summing operation in Python 3.6.0:

6.89 + .1

I got the result 6.9899999999 This causes a bug in my code. How to fix this, such that the results be similar to 6.99? Please note I can't handle this by trying to approximate the result using my own code. Since I'm working on time series processing, it would create other problems. In other words, I'm looking for a solution using "the language settings".

hbak
  • 1,333
  • 3
  • 10
  • 22
  • 1
    Perhaps look into the [`Decimal`](https://docs.python.org/3.0/library/decimal.html) library. – internet_user Jan 09 '18 at 15:31
  • 1
    And read the floating point section of the [tutorial](https://docs.python.org/3/tutorial/floatingpoint.html). – DSM Jan 09 '18 at 15:34

0 Answers0