Re: New // operator
by David Ascher other posts by this author
Apr 30 2002 6:04PM messages near this date
view in the new Beta List Site
RE: New // operator
|
Re: New // operator
Syver Enstad wrote:
> "Matthew Sherborne" <miracle@[...].nz> writes:
>
> >So I now realize that it is not "Integer Division", it is "Division
> >with the
> >result rounded down".
> >
>
> I think you want this instead:
>
> round(5/2)
>
> By the way whats wrong with 5/2 = 2 ?
> You have five tennisballs, split them on two persons. Surely they can't
> have more than two tennisballs each.
>
Most people who aren't familiar with integer division expect 1/2 to
yield 0.5, not 0. This confusion is what motivated the work outlined in
the PEP. Further motivational details are available in the PEP.
--david ascher
_______________________________________________
ActivePython mailing list
ActivePython@[...].com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
Other options: http://listserv.ActiveState.com/mailman/listinfo/ActivePython
Thread:
Matthew Sherborne
Syver Enstad
Eric Sloane
Kari Hoijarvi
David Ascher
Jeff Shannon
David Ascher
|