Issue 1355903: Division Error - Python tracker (original) (raw)
Issue1355903
Created on 2005-11-13 14:41 by azimuth84, last changed 2022-04-11 14:56 by admin. This issue is now closed.
| Messages (2) | ||
|---|---|---|
| msg26873 - (view) | Author: Azimuth (azimuth84) | Date: 2005-11-13 14:41 |
| The division operation "7.0/5" yields 1.399999 instead of 1.4 | ||
| msg26874 - (view) | Author: Fredrik Lundh (effbot) * ![]() |
Date: 2005-11-13 15:52 |
| Logged In: YES user_id=38376 This is not a bug. Binary floating point cannot represent decimal fractions exactly, so some rounding always occurs (even in Python 1.5.2). What changed is that Python 2.0 shows more precision than before in certain circumstances (repr() and the interactive prompt). You can use str() or print to get the old, rounded output: >>> print 0.1+0.1 0.2 >>> Follow the link for more information: http://www.python.org/doc/2.2.1/tut/node14.html |
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2022-04-11 14:56:14 | admin | set | github: 42589 |
| 2005-11-13 14:41:02 | azimuth84 | create |
