Le dimanche 23 octobre 2016 16:20:25 UTC+2, John Cremona a écrit : > > I see that despite the title of that ticket, this is (at present) > about r%n when r =p/q is rational. >
The ticket also cares about the case where n is rational. Moreover my proposed branch makes % part of the coercion system (when one of the argument is rational). So standard coercion rules apply. However, concerning this thread, my question is about r%n with r=p/q being rational. Questions: > > 1. What is the proposed behaviour when q is not invertible modulo n? > Or more generally, if q*x=p (mod n) has no solutions, or more than > one solution (mod n)? > The very same behavior as with the two implementation I proposed. In other words, raise the same errors as inverse_mod does when it complains. Concerning the non-uniqueness, it is just a matter of having an extra argument to inverse_mod on integers and using it here. Do you think it might be useful? > 2. Is the output going to be an element of Z/nZ, or of Z (as your > sample code suggests)? > I was thinking about Z since for Z/nZ the direct conversion just works Zmod(n)(r). Vincent -- You received this message because you are subscribed to the Google Groups "sage-devel" group. To unsubscribe from this group and stop receiving emails from it, send an email to sage-devel+unsubscr...@googlegroups.com. To post to this group, send email to sage-devel@googlegroups.com. Visit this group at https://groups.google.com/group/sage-devel. For more options, visit https://groups.google.com/d/optout.