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: print (float) of Python 2.0
Type: Stage:
Components: None Versions:
process
Status: closed Resolution: not a bug
Dependencies: Superseder:
Assigned To: Nosy List: loewis
Priority: normal Keywords:

Created on 2001-03-04 17:28 by anonymous, last changed 2022-04-10 16:03 by admin. This issue is now closed.

Messages (2)
msg3693 - (view) Author: Nobody/Anonymous (nobody) Date: 2001-03-04 17:28
Python's float type is double precision.
Look at the position where the numbers are rounded. 


Result on Python 2.0 (or 2.1 alpha 2)

>>> 0.8
0.80000000000000004
>>> print 0.80000000000000004
0.8
>>> print 0.8000000000004
0.8
>>> print 0.7999999999999
0.8
>>> print 0.7999999999995
0.8
>>> print 0.7999999999994
0.799999999999



Result on Jython 2.0

>>> 0.8
0.8
>>> print 0.80000000000000004
0.8
>>> print 0.8000000000004
0.8000000000004
>>> print 0.7999999999999
0.7999999999999
>>> print 0.7999999999995
0.7999999999995
>>> print 0.7999999999994
0.7999999999994

msg3694 - (view) Author: Martin v. Löwis (loewis) * (Python committer) Date: 2001-03-04 18:31
Logged In: YES 
user_id=21627

What is the bug that you want to report? It is perfectly
fine that CPython and Jython behave differently in this
respect. CPython uses the C double type, and inherits all
its semantics; Jython uses the Java double type - which
might be different, since the C standard does not say what
double is (only that it is more precise than float).

If you meant to report a more specific problem than the mere
difference, please re-report.
History
Date User Action Args
2022-04-10 16:03:48adminsetgithub: 34058
2001-03-04 17:28:37anonymouscreate