1# GMP mpz module.
2
3# Copyright 2001, 2002, 2003 Free Software Foundation, Inc.
4#
5# This file is part of the GNU MP Library.
6#
7# The GNU MP Library is free software; you can redistribute it and/or modify
8# it under the terms of the GNU Lesser General Public License as published
9# by the Free Software Foundation; either version 3 of the License, or (at
10# your option) any later version.
11#
12# The GNU MP Library is distributed in the hope that it will be useful, but
13# WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
14# or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
15# License for more details.
16#
17# You should have received a copy of the GNU Lesser General Public License
18# along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
19
20
21package GMP::Mpz;
22
23require GMP;
24require Exporter;
25@ISA = qw(GMP Exporter);
26@EXPORT = qw();
27@EXPORT_OK = qw();
28%EXPORT_TAGS = ('all' => [qw(
29			     bin cdiv cdiv_2exp clrbit combit congruent_p
30			     congruent_2exp_p divexact divisible_p
31			     divisible_2exp_p even_p fac fdiv fdiv_2exp fib
32			     fib2 gcd gcdext hamdist invert jacobi kronecker
33			     lcm lucnum lucnum2 mod mpz mpz_export
34			     mpz_import nextprime odd_p perfect_power_p
35			     perfect_square_p popcount powm probab_prime_p
36			     realloc remove root roote rootrem scan0 scan1
37			     setbit sizeinbase sqrtrem tdiv tdiv_2exp
38			     tstbit)],
39		'constants'   => [@EXPORT],
40		'noconstants' => [@EXPORT]);
41Exporter::export_ok_tags('all');
42
43use overload
44    '+'    => \&overload_add,     '+='   => \&overload_addeq,
45    '-'    => \&overload_sub,     '-='   => \&overload_subeq,
46    '*'    => \&overload_mul,     '*='   => \&overload_muleq,
47    '/'    => \&overload_div,     '/='   => \&overload_diveq,
48    '%'    => \&overload_rem,     '%='   => \&overload_remeq,
49    '<<'   => \&overload_lshift,  '<<='  => \&overload_lshifteq,
50    '>>'   => \&overload_rshift,  '>>='  => \&overload_rshifteq,
51    '**'   => \&overload_pow,     '**='  => \&overload_poweq,
52    '&'    => \&overload_and,     '&='   => \&overload_andeq,
53    '|'    => \&overload_ior,     '|='   => \&overload_ioreq,
54    '^'    => \&overload_xor,     '^='   => \&overload_xoreq,
55
56    'bool' => \&overload_bool,
57    'not'  => \&overload_not,
58    '!'    => \&overload_not,
59    '~'    => \&overload_com,
60    '<=>'  => \&overload_spaceship,
61    '++'   => \&overload_inc,
62    '--'   => \&overload_dec,
63    '='    => \&overload_copy,
64    'abs'  => \&overload_abs,
65    'neg'  => \&overload_neg,
66    'sqrt' => \&overload_sqrt,
67    '""'   => \&overload_string;
68
69sub import {
70  foreach (@_) {
71    if ($_ eq ':constants') {
72      overload::constant ('integer' => \&overload_constant,
73			  'binary'  => \&overload_constant,
74			  'float'   => \&overload_constant);
75    } elsif ($_ eq ':noconstants') {
76      overload::remove_constant ('integer' => \&overload_constant,
77				 'binary'  => \&overload_constant,
78				 'float'   => \&overload_constant);
79    }
80  }
81  goto &Exporter::import;
82}
83
841;
85__END__
86
87
88# Local variables:
89# perl-indent-level: 2
90# End:
91