bmodinv#
Return the modular inverse of $x mod $y.
Synopsis#
my $x = Math::GMP->new(5);
my $inv = $x->bmodinv(7); # 3, because 5 * 3 == 1 (mod 7)
When $x has no inverse modulo $y (i.e. gcd($x, $y) != 1),
returns 0. Behaviour is undefined when $y is 0.
Edge cases#
bmodinvreturning0is ambiguous:0is never a valid inverse, so treat it as “no inverse exists”.