[sage-devel] Re: Bug in Rational.__mod__ (and maybe Integer.inverse_mod)

2009-09-15 Thread Dirk
On Sep 15, 5:48 pm, David Roe wrote: > I agree that the results are inconsistent, but it is true that 0*d = 1 (mod > 1).   Aha. That statement does not mean (0*d)%1 == 1. It means $ 0\times d \equiv_1 1.$ Maybe the examples 1.inverse_mod(0) and 0.inverse_mod(1) could be added to the docstring

[sage-devel] Re: Bug in Rational.__mod__ (and maybe Integer.inverse_mod)

2009-09-15 Thread David Roe
I agree that the results are inconsistent, but it is true that 0*d = 1 (mod 1). And as a number theorist, I like the current behavior better than your proposed solution, which would translate x into the interval [0,d). I would suggest changing 4705 of integer.pyx to: if mpz_cmp_ui(m.value, 1)