Martin Becker >
Math-ModInt >
Math::ModInt::Trivial

Module Version: 0.001
Math::ModInt::Trivial - integer arithmetic modulo one

This documentation refers to version 0.001 of Math::ModInt::Trivial.

use Math::ModInt qw(mod); $a = mod(0, 1); # 0 [mod 1] $b = $a->new(0); # 0 [mod 1] $c = $a + $b; # 0 [mod 1] $d = $a**2 - $b/$a; # 0 [mod 1] print $d->residue, " [mod ", $b->modulus, "]"; # prints 0 [mod 1] print "$d\n"; # prints mod(0, 1) $bool = $c == $d; # true

Math::ModInt::Trivial is an implementation of Math::ModInt for modulus one. Like all Math::ModInt implementations, it is loaded behind the scenes when there is demand for it, without applications needing to worry about it.

The residue class modulo one is the only ring where division by zero is defined, because the single element is its own multiplicative inverse. While operating on a one-element space may seem rather pointless, modular arithmetic would be incomplete without it, as it is a valid quotient ring of the ring of integers.

- Math::ModInt
- The subject "trivial ring" on Wikipedia. http://en.wikipedia.org/wiki/Trivial_ring

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

Copyright (c) 2009-2010 by Martin Becker. All rights reserved.

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.6.0 or, at your option, any later version of Perl 5 you may have available.

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.

syntax highlighting: