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