[Python-ideas] integer dividion in R -- PS

spir ☣ denis.spir at gmail.com
Fri May 7 09:57:51 CEST 2010


Hello again,

I searched the def of int division in R. I could not find it in the english wikipedia, but in the french one, there was http://fr.wikipedia.org/wiki/Division_enti%C3%A8re#Division_euclidienne_dans_les_entiers_relatifs:
    for each pair (a,b) in ZxZ*, there exists (q,r) in ZxZ |
        a = b*q + r   |   |r| < |b|
This implies that if a xor b is negative, thare are 2 of solutions: the one where (q,r) is equal in absolute value to the solution in N, and (q-1,r+b). So, in the case of -4/3, we have the choice between (-1,-1) and (-2,2).

The following discussion in the article does not tell whether one solution is the _official_ one.
But: that   -4/3 != -(4/3)   looks simply wrong for me.

Denis
________________________________

vit esse estrany ☣

spir.wikidot.com



More information about the Python-ideas mailing list