On Mar 8, 7:22 pm, farsi...@gmail.com wrote: > On Mar 8, 2:16 pm, farsi...@gmail.com wrote: > > > >>> 4 / 5.0 > > > 0.800000000000000004>>> 0.8 * 5 > > > 4.0 > > > python 2.6.1 on mac. What the hell is going on here? > > Pure curiosity prompted me to try the following:>>> 40 / 5.0 > > 8.0 > > Strange...
Please see http://docs.python.org/library/decimal.html for explanation of why this happens. To get the proper values, try >>> Decimal(4)/Decimal("5.0") Decimal("0.8") -- http://mail.python.org/mailman/listinfo/python-list