floating point division -- question

Gerhard Häring gerhard.haering at opus-gmbh.net
Wed Nov 27 12:11:22 EST 2002


William Park <opengeometry at yahoo.ca> wrote:
> Some time ago, there was thread discussing adding a floating point division
> operator, like //.  Doing 'a//b' is certainly easier than doing 'a/float(b)',
> and it doesn't break any existing codes.  Has there been any interest from
> the Gods of Python?

Python 2.2.2 (#37, Oct 14 2002, 17:02:34) [MSC 32 bit (Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> from __future__ import division
>>> 3 / 5
0.59999999999999998
>>> 3 // 5
0

It's been there since the original Python 2.2 release. See
http://www.python.org/doc/current/whatsnew/node7.html for details.
-- 
Gerhard Häring
OPUS GmbH München
Tel.: +49 89 - 889 49 7 - 32
http://www.opus-gmbh.net/



More information about the Python-list mailing list