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: Basic precision calc error
Type: behavior Stage: resolved
Components: Interpreter Core Versions: Python 3.5
process
Status: closed Resolution: not a bug
Dependencies: Superseder:
Assigned To: Nosy List: Renner, zach.ware
Priority: normal Keywords:

Created on 2016-11-19 01:52 by Renner, last changed 2022-04-11 14:58 by admin. This issue is now closed.

Messages (2)
msg281191 - (view) Author: Renner (Renner) Date: 2016-11-19 01:52
Simple code:
 print('%.55f' %(1.1 + 2.2 - 3.3))
 print('%.55f' %(1.1 + 2.2))
is supposed to produce
 0.0000000000000000000000000000000000000000000000000000000
 3.3000000000000000000000000000000000000000000000000000000
But when I run it, Actually it produces 
 0.0000000000000004440892098500626161694526672363281250000
 3.3000000000000002664535259100375697016716003417968750000

Found by chance...

python 3.5.2
sysname:'Darwin'
release:'15.6.0
version:'Darwin Kernel Version 15.6.0: Thu Jun 23 18:25:34 PDT 2016; root:xnu-3248.60.10~1/RELEASE_X86_64')
msg281192 - (view) Author: Zachary Ware (zach.ware) * (Python committer) Date: 2016-11-19 02:13
https://docs.python.org/3/tutorial/floatingpoint.html
History
Date User Action Args
2022-04-11 14:58:39adminsetgithub: 72930
2016-11-19 02:13:35zach.waresetstatus: open -> closed

nosy: + zach.ware
messages: + msg281192

resolution: not a bug
stage: resolved
2016-11-19 01:52:48Rennercreate