mpz_invert (x, 1, 0)

bodrato at mail.dm.unipi.it bodrato at mail.dm.unipi.it
Thu Mar 1 17:33:01 CET 2012


Ciao,

Il Gio, 1 Marzo 2012 4:23 pm, Joerg Arndt ha scritto:
> If mod zero is allowed at all it should
> return the first argument unchanged:
>   mod(x,0) = x  for all x
>
> So the behavior below is what I would expect.

Maybe you are right, but ...

I did not specify that for any non-unity value n, the current mpz_invert,
returns "non invertible" for the modulus 0.

Moreover the old documentation promised to return an inverse r so that
0<=r<m, where m is the modulus. If m=0, no return value r is allowed by
this restriction: mod zero should not be allowed at all.

I recently changed the documentation writing "0<r<m", but I now realize
that I should change it again, because a negative modulus is allowed:
"0<r<|m|"

Regards, m

-- 
http://bodrato.it/papers/
http://www.notav.eu/modules.php?name=ePetitions&op=more_info&ePetitionId=3



More information about the gmp-devel mailing list