[Numpy-discussion] Re: numpy, overflow, inf, ieee, and rich , comparison

Alex Martelli aleaxit at yahoo.com
Fri Oct 27 18:39:49 EDT 2000


"Johann Hibschman" <johann at physics.berkeley.edu> wrote in message
news:mtu29y11ip.fsf at astron.berkeley.edu...
    [snip]
> By the way, what is the logic behind "-1/-3 = 0"?  That just seems
> broken.  -1/3 = -1, so we should have -1/-3 = 1.  If division were
> defined that way, we could simply let % give the least positive
> residue, and everyone would be happy.
>
> Is there any situation in which you would want -1/-3 = 0?

There are many nice properties you might like integer
division to have; unfortunately, they're self contradictory
en masse -- you can't have them all at once.

For example, for any non-null integers a,b,c, we might
like to have
    a/b == (a*c)/(b*c)
right?  After all, we can see algebraically that the factors
of c in numerator and denominator simplify out...

Well, what happens if a=1, b=3, and c=-1, then?-)


Alex






More information about the Python-list mailing list