Issue34153
Created on 2018-07-18 19:18 by wassersteinchen, last changed 2022-04-11 14:59 by admin. This issue is now closed.
| Messages (2) | |||
|---|---|---|---|
| msg321909 - (view) | Author: (wassersteinchen) | Date: 2018-07-18 19:18 | |
Hi, I am new to python and just installed it on my win pc. First thing what I did were some calculations (see below). There is a failure in th last digit at 10/3 and 100/3. Sorry if this is a RTFM-issue... armin Python 3.7.0 (v3.7.0:1bf9cc5093, Jun 27 2018, 04:06:47) [MSC v.1914 32 bit (Intel)] on win32 Type "copyright", "credits" or "license()" for more information. >>> 3+6 9 >>> 10/3 3.3333333333333335 >>> 1/3 0.3333333333333333 >>> 10/3 3.3333333333333335 >>> 100/3 33.333333333333336 >>> 1000/3 333.3333333333333 >>> 10000/3 3333.3333333333335 >>> 100000/3 33333.333333333336 >>> 1000000/3 333333.3333333333 >>> 200/3 66.66666666666667 |
|||
| msg321910 - (view) | Author: Paul Moore (paul.moore) * ![]() |
Date: 2018-07-18 19:27 | |
See https://docs.python.org/3.7/tutorial/floatingpoint.html. Essentially, the behaviour you are seeing is caused by the fact that the results calculations you are attempting cannot be exactly represented in binary floating point, so approximate results are shown. |
|||
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2022-04-11 14:59:03 | admin | set | github: 78334 |
| 2018-07-18 19:27:11 | paul.moore | set | status: open -> closed resolution: not a bug messages: + msg321910 stage: resolved |
| 2018-07-18 19:18:40 | wassersteinchen | create | |
