On Sep 15, 5:48 pm, David Roe <r...@math.harvard.edu> 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.
Are they the only nonnegative exceptions to the rule that (x*self)%m =
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).
True.  Even worse than being offensive to number theory, my solution
is also inconsistent with Python.  So change it to
      n = int(self)
      return n%d + (self-n)

Dirk
--~--~---------~--~----~------------~-------~--~----~
To post to this group, send an email to sage-devel@googlegroups.com
To unsubscribe from this group, send an email to 
sage-devel-unsubscr...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/sage-devel
URL: http://www.sagemath.org
-~----------~----~----~----~------~----~------~--~---

Reply via email to