J
jmfauth
This is just an attempt to put the
http://groups.google.com/group/comp.lang.python/browse_thread/thread/a008af1ac2968833#
discussion at a correct level.
With Python 2.7 a new float number representation (the David Gay's
algorithm)
has been introduced. If this is well honored in Python 2.7, it
seems to me, there are some missmatches in the Py3 series.
'2.5.4 (r254:67916, Dec 23 2008, 15:10:54) [MSC v.1310 32 bit
(Intel)]'
jmf
http://groups.google.com/group/comp.lang.python/browse_thread/thread/a008af1ac2968833#
discussion at a correct level.
With Python 2.7 a new float number representation (the David Gay's
algorithm)
has been introduced. If this is well honored in Python 2.7, it
seems to me, there are some missmatches in the Py3 series.
'2.5.4 (r254:67916, Dec 23 2008, 15:10:54) [MSC v.1310 32 bit
(Intel)]'
sys.version 2.7.2 (default, Jun 12 2011, 15:08:59) [MSC v.1500 32 bit (Intel)]
0.1 0.1
print 0.1 0.1
1.1 * 1.1 1.21
print 1.1 * 1.1 1.21
print repr(1.1 * 1.1) 1.2100000000000002'1.21'sys.version '3.1.4 (default, Jun 12 2011, 15:05:44) [MSC v.1500 32 bit (Intel)]'
0.1 0.1
print(0.1) 0.1
1.1 * 1.1 1.2100000000000002
print(1.1 * 1.1) 1.21
print(repr(1.1 * 1.1)) 1.2100000000000002
'{:g}'.format(1.1 * 1.1)
sys.version '3.2.2 (default, Sep 4 2011, 09:51:08) [MSC v.1500 32 bit (Intel)]'
0.1 0.1
print(0.1) 0.1
1.1 * 1.1 1.2100000000000002
print (1.1 * 1.1) 1.2100000000000002
print(repr((1.1 * 1.1))) 1.2100000000000002
'{:g}'.format(1.1 * 1.1) '1.21'
jmf