floating point division -- question

Dan Bishop danb_83 at yahoo.com
Wed Nov 27 17:45:00 EST 2002


William Park <opengeometry at yahoo.ca> wrote in message news:<as31ig$n7lq2$1 at ID-99293.news.dfncis.de>...
> Gerhard H?ring <gerhard.haering at opus-gmbh.net> wrote:
> > 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.
> 
> Thanks Gerhard.  Although I would've have switched the two operator, so
> that existing code doesn't change...

But that would be incompatible with divisions that were already
intended to be floating-point.



More information about the Python-list mailing list