Integers and Floats
Gerrit Holl
gerrit.holl at pobox.com
Mon Oct 11 12:07:28 EDT 1999
Hello,
I know there is a difference between integers and floats, but I think the
following is a little strange:
18:07:48:3/499:gerrit at gerrit:~$ python
Python 1.5.2 (#1, Aug 8 1999, 01:35:00) [GCC egcs-2.91.66 19990314/Linux (egcs- on linux2
Copyright 1991-1995 Stichting Mathematisch Centrum, Amsterdam
>>> 131 / 4
32
>>> 4 * 32
128
>>> 131 / 4 * 4
128
I think the ouput of the first two statement is ok, but why can't python store
an integer and a float as the same thing? And is the conversion between an
integer and a float so big? Or are floats just slower? Do I have to do the
following:
>>> int(float(131) / 4 * 4)
131
Is that neccesary for this one?
regards,
Gerrit.
--
linuxgames.nl.linux.org All about games on Linux in Dutch (under construction).
www.nl.linux.org The Dutch resource for Dutch Linux documentation.
www.nl.linux.org/discoverb Learn foreign words and definitions.
www.nl.linux.org/~gerrit/asperger I'm an Asperger, go here for more info.
www.nl.linux.org/~gerrit About me and pictures of me.
More information about the Python-list
mailing list