This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: Multiplication issue with 16.1
Type: behavior Stage: resolved
Components: IDLE Versions: Python 3.3
process
Status: closed Resolution: not a bug
Dependencies: Superseder:
Assigned To: Nosy List: JULIE.MCMANUS, martin.panter, terry.reedy
Priority: normal Keywords:

Created on 2017-09-06 10:59 by JULIE.MCMANUS, last changed 2022-04-11 14:58 by admin. This issue is now closed.

Messages (4)
msg301458 - (view) Author: Julie (JULIE.MCMANUS) Date: 2017-09-06 10:59
Multipy 16.1 by 100 or 1000 returns a result to 13 decimal places. See example - 

>>> 16.2*1000
16200.0
>>> 16.1*1000
16100.000000000002
>>> 16.1*100
1610.0000000000002
>>> 16.1*10
161.0
>>> 16.2*1000
16200.0
msg301463 - (view) Author: Martin Panter (martin.panter) * (Python committer) Date: 2017-09-06 11:39
The floating-point numbers are only accurate to about 16 digits. You probably just found a value that cannot be exactly represented.

https://docs.python.org/3.3/faq/design.html#why-are-floating-point-calculations-so-inaccurate
msg301464 - (view) Author: Julie (JULIE.MCMANUS) Date: 2017-09-06 11:42
Thank you Martin, makes sense now that I have read the documentation.
Julie
msg301483 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2017-09-06 16:53
Also, IDLE wraps Python and is not responsible for what Python calculates.
History
Date User Action Args
2022-04-11 14:58:52adminsetgithub: 75546
2017-09-06 16:53:59terry.reedysetassignee: terry.reedy ->
messages: + msg301483
2017-09-06 11:42:29JULIE.MCMANUSsetmessages: + msg301464
2017-09-06 11:39:15martin.pantersetstatus: open -> closed

nosy: + martin.panter
messages: + msg301463

resolution: not a bug
stage: resolved
2017-09-06 10:59:13JULIE.MCMANUScreate