Strange behavior of int()

Dan Sommers me at privacy.net
Thu Jan 26 22:06:19 EST 2006


On 26 Jan 2006 18:42:34 -0800,
"Brian" <bkrisler at gmail.com> wrote:

> If I execute a similar command from the command line, it works just
> fine:
>>>> int(0.05/0.05)
> 1

Try this:

>>> print 2.3 - int(2.3/.25)*.25
0.05
>>> 2.3 - int(2.3/.25)*.25
0.049999999999999822

Then check out <http://docs.python.org/tut/node16.html>.

Regards,
Dan

-- 
Dan Sommers
<http://www.tombstonezero.net/dan/>



More information about the Python-list mailing list