Inverses in the zero ring (poll)

Torbjorn Granlund tg at
Thu Jan 2 11:45:16 UTC 2014

The function mpz_invert computes inveses modulo an integer, or returns
an error indication when fed with a divisor of zero.

The current code handles the zero ring (i.e., modulo 1) specially and
considers no integer to be invertible.

Is that correct?  We're considering to change this behaviour.

The argument is that an inverse of a is definied to exist is ab = 1 for
some b.  In this ring 0 = 1 and thus are all integers congrent with 0.
We have ab = 0 = 1 for any a and b.  Thus any integer is invertible in
this ring.

Please speak up if you disagree.


More information about the gmp-devel mailing list