The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Math::ModInt::BigInt - modular integer arithmetic, powered by Math::BigInt

VERSION

This documentation refers to version 0.013 of Math::ModInt::BigInt.

SYNOPSIS

  use Math::ModInt qw(mod);

  $a = Math::ModInt->new(3, 76543);               # 3 [mod 76543]
  $a = mod(3, 76543);                             # 3 [mod 76543]
  $b = $a->new(4);                                # 4 [mod 76543]
  $c = $a + $b;                                   # 7 [mod 76543]
  $d = $a**2 - $b/$a;                             # 25522 [mod 76543]

  print $a->residue, " [mod ", $b->modulus, "]";  # prints 3 [mod 76543]
  print "$a";                                     # prints mod(3, 76543)

  $bool = $c == $d;                               # false

DESCRIPTION

Math::ModInt::BigInt is a generic implementation of Math::ModInt for arbitrarily large moduli. Like all Math::ModInt implementations, it is loaded behind the scenes when there is demand for it, without applications needing to worry about it.

Note, however, that values returned by residue or modulus may be Math::BigInt objects rather than plain Perl numbers when this implementation has actually been involved.

SEE ALSO

Math::ModInt, Math::BigInt.

AUTHOR

Martin Becker, <becker-cpan-mp at cozap.com>

LICENSE AND COPYRIGHT

Copyright (c) 2009-2021 Martin Becker, Blaubeuren.

This library is free software; you can distribute it and/or modify it under the terms of the Artistic License 2.0 (see LICENSE file).

DISCLAIMER OF WARRANTY

This library is distributed in the hope that it will be useful, but without any warranty; without even the implied warranty of merchantability or fitness for a particular purpose.