Math-GMP-2.06/0000755000076400007640000000000011254504621011415 5ustar greggregMath-GMP-2.06/.perlcriticrc0000644000076400007640000000437611254503646014123 0ustar greggregverbose = 9 profile-strictness = quiet [Documentation::PodSpelling] stop_words = Mullane BigInt gmp tradeoff bfac bxor bior bgcd Divisior returnes legendre jacobi fibonacci n'th Biggar Ilya Zakharevich [-Bangs::ProhibitNumberedNames] [-Bangs::ProhibitVagueNames] [-BuiltinFunctions::ProhibitStringyEval] [-ClassHierarchies::ProhibitAutoloading] [-ClassHierarchies::ProhibitExplicitISA] [-CodeLayout::ProhibitParensWithBuiltins] [-CodeLayout::RequireTidyCode] [-CodeLayout::RequireUseUTF8] [-ControlStructures::ProhibitCascadingIfElse] [-ControlStructures::ProhibitPostfixControls] [-Documentation::RequirePodSections] [-Documentation::RequirePODUseEncodingUTF8] [-Editor::RequireEmacsFileVariables] [-ErrorHandling::RequireCarping] [-ErrorHandling::RequireCheckingReturnValueOfEval] [-ErrorHandling::RequireUseOfExceptions] [-InputOutput::ProhibitBacktickOperators] [-InputOutput::ProhibitOneArgSelect] [-InputOutput::RequireCheckedSyscalls] [-Lax::ProhibitEmptyQuotes::ExceptAsFallback] [-Lax::ProhibitStringyEval::ExceptForRequire] [-Lax::RequireEndWithTrueConst] [-Miscellanea::RequireRcsKeywords] [-Miscellanea::ProhibitUnrestrictedNoCritic] [-Modules::ProhibitAutomaticExportation] [-Modules::ProhibitExcessMainComplexity] [-Modules::RequireEndWithOne] [-Modules::RequireExplicitInclusion] [-References::ProhibitDoubleSigils] [-RegularExpressions::ProhibitCaptureWithoutTest] [-RegularExpressions::ProhibitEnumeratedClasses] [-RegularExpressions::ProhibitEscapedMetacharacters] [-RegularExpressions::RequireDotMatchAnything] [-RegularExpressions::RequireExtendedFormatting] [-RegularExpressions::RequireLineBoundaryMatching] [-Subroutines::ProhibitCallsToUndeclaredSubs] [-Subroutines::ProhibitCallsToUnexportedSubs] [-Subroutines::RequireArgUnpacking] [-ValuesAndExpressions::ProhibitAccessOfPrivateData] [-ValuesAndExpressions::ProhibitEmptyQuotes] [-ValuesAndExpressions::ProhibitEscapedCharacters] [-ValuesAndExpressions::ProhibitInterpolationOfLiterals] [-ValuesAndExpressions::ProhibitMagicNumbers] [-ValuesAndExpressions::ProhibitMixedBooleanOperators] [-ValuesAndExpressions::RequireInterpolationOfMetachars] [-ValuesAndExpressions::RestrictLongStrings] [-Variables::ProhibitPunctuationVars] [-Variables::RequireInitializationForLocalVars] [-Variables::RequireLocalizedPunctuationVars] Math-GMP-2.06/README0000644000076400007640000000101211254503136012267 0ustar greggregNAME Math::GMP - High speed arbitrary size integer math SYNOPSIS use Math::GMP; my $n = new Math::GMP 2; $n = $n ** (256*1024); $n = $n - 1; print "n is now $n\n"; DESCRIPTION Math::GMP gives you access to the fast GMP library for fast big integer math. AUTHOR Chip Turner , based on Math::BigInt by Mark Biggar and Ilya Zakharevich. Further extensive work provided by Tels . Later non-extensive work by Greg Sabino Mullane. Math-GMP-2.06/Changes0000644000076400007640000000316111254503446012715 0ustar greggregRevision history for Perl extension Math::GMP. 2.06 2009-09-17 Greg - Make Makefile.PL more forgiving of gmp library locations. (CPAN bug #46323) - Update link to libgmp.org in INSTALL file (CPAN bug #46324) 2.05 2008-10-06 Greg - New maintainer: Greg Sabino Mullane - Allow tests to work on 64-bit platforms. Patch from Flo. (CPAN bugs #5960, #30327, #27641, #12751, #15459) - Add support for probab_prime function. Patch by shlomif@iglu.org.il. (CPAN bug #6184) - Get smarter about detecting lack of GMP libraries. (CPAN bug #18709) - Add META.yml and some more tests. 2.04 2004-09-28 cturner - added patch from Nicholas Oxhøj for constructing with different bases (nicholas@oxhoej.dk) (CPAN bug #4472) 2.03 2002-02-16 Tels - added internal functions gmp_copy, gmp_tstbit, gmp_sqrt - moved test.pl to t/gmppmt, made it use Test and use strict - moved GMP.pm to lib/Math/GMP.pm - documented some of the public methods - fixed README - added INSTALL file 2.02 Sat Feb 15 16:10:00 2002 Tels - added internal functions gmp_fac, gmp_fib, and_two, or_two, xor_two - added band, bior, bxor, bfac - added overload for &, ^ and | - tests for new functions 2.00 Fri Feb 08 16:00:00 2002 cturner - remove gmp inside of package, performance improvements, some new ops 1.07 2001-04-22 cturner 1.06 2001-04-10 cturner 1.05 2001-02-23 cturner 1.04 2001-02-13 cturner 1.03 2001-01-25 cturner 1.02 2001-01-20 cturner 1.01 2000-03-21 cturner 1.00 2000-02-25 cturner 0.9 1999-09-19 cturner 0.01 Fri Sep 17 21:07:40 1999 cturner - original version; created by h2xs 1.19 Math-GMP-2.06/Makefile.PL0000644000076400007640000000140611254502235013367 0ustar greggreg#!perl use strict; use warnings; use ExtUtils::MakeMaker; my $output = WriteMakefile ( 'NAME' => 'Math::GMP', 'VERSION_FROM' => 'lib/Math/GMP.pm', 'LIBS' => ['-lgmp'], 'NO_META' => 1, ); if (!exists $output->{EXTRALIBS} or $output->{EXTRALIBS} !~ /gmp/) { my $makefile = exists $output->{MAKEFILE} ? "\nRemoving ($output->{MAKEFILE})\n" : ''; warn qq{ ========================================================== WARNING! No GMP libraries were detected! Please see the INSTALL file. =========================================================== }; ## Do not let make proceed if ($makefile) { print $makefile; unlink $output->{MAKEFILE}; } unlink $output->{MAKEFILE} if $makefile; exit 1; } exit 0; # end of Makefile.PL Math-GMP-2.06/GMP.xs0000644000076400007640000001566311072421717012431 0ustar greggreg#include "EXTERN.h" #include "perl.h" #include "XSUB.h" #include "gmp.h" /* Math::GMP, a Perl module for high-speed arbitrary size integer calculations Copyright (C) 2000 James H. Turner This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. 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. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; if not, write to the Free Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA You can contact the author at chip@redhat.com, chipt@cpan.org, or by mail: Chip Turner Red Hat Inc. 2600 Meridian Park Blvd Durham, NC 27713 */ static int not_here(char *s) { croak("%s not implemented on this architecture", s); return -1; } static double constant(char *name, int arg) { errno = 0; switch (*name) { } errno = EINVAL; return 0; not_there: errno = ENOENT; return 0; } MODULE = Math::GMP PACKAGE = Math::GMP PROTOTYPES: ENABLE double constant(name,arg) char * name int arg mpz_t * new_from_scalar(s) char * s CODE: RETVAL = malloc (sizeof(mpz_t)); mpz_init_set_str(*RETVAL, s, 0); OUTPUT: RETVAL mpz_t * new_from_scalar_with_base(s, b) char * s int b CODE: RETVAL = malloc (sizeof(mpz_t)); mpz_init_set_str(*RETVAL, s, b); OUTPUT: RETVAL void destroy(n) mpz_t *n CODE: mpz_clear(*n); free(n); SV * stringify_gmp(n) mpz_t * n PREINIT: int len; CODE: len = mpz_sizeinbase(*n, 10); { char *buf; buf = malloc(len + 2); mpz_get_str(buf, 10, *n); RETVAL = newSVpv(buf, strlen(buf)); free(buf); } OUTPUT: RETVAL SV * get_str_gmp(n, b) mpz_t * n int b PREINIT: int len; CODE: len = mpz_sizeinbase(*n, b); { char *buf; buf = malloc(len + 2); mpz_get_str(buf, b, *n); RETVAL = newSVpv(buf, strlen(buf)); free(buf); } OUTPUT: RETVAL int sizeinbase_gmp(n, b) mpz_t * n int b CODE: RETVAL = mpz_sizeinbase(*n, b); OUTPUT: RETVAL unsigned long uintify_gmp(n) mpz_t * n CODE: RETVAL = mpz_get_ui(*n); OUTPUT: RETVAL void add_ui_gmp(n, v) mpz_t * n unsigned long v CODE: mpz_add_ui(*n, *n, v); long intify_gmp(n) mpz_t * n CODE: RETVAL = mpz_get_si(*n); OUTPUT: RETVAL mpz_t * mul_2exp_gmp(n, e) mpz_t * n unsigned long e CODE: RETVAL = malloc (sizeof(mpz_t)); mpz_init(*RETVAL); mpz_mul_2exp(*RETVAL, *n, e); OUTPUT: RETVAL mpz_t * div_2exp_gmp(n, e) mpz_t * n unsigned long e CODE: RETVAL = malloc (sizeof(mpz_t)); mpz_init(*RETVAL); mpz_div_2exp(*RETVAL, *n, e); OUTPUT: RETVAL mpz_t * powm_gmp(n, exp, mod) mpz_t * n mpz_t * exp mpz_t * mod CODE: RETVAL = malloc (sizeof(mpz_t)); mpz_init(*RETVAL); mpz_powm(*RETVAL, *n, *exp, *mod); OUTPUT: RETVAL mpz_t * mmod_gmp(a, b) mpz_t * a mpz_t * b CODE: RETVAL = malloc (sizeof(mpz_t)); mpz_init(*RETVAL); mpz_mmod(*RETVAL, *a, *b); OUTPUT: RETVAL mpz_t * mod_2exp_gmp(in, cnt) mpz_t * in unsigned long cnt CODE: RETVAL = malloc (sizeof(mpz_t)); mpz_init(*RETVAL); mpz_mod_2exp(*RETVAL, *in, cnt); OUTPUT: RETVAL mpz_t * add_two(m,n) mpz_t * m mpz_t * n CODE: RETVAL = malloc (sizeof(mpz_t)); mpz_init(*RETVAL); mpz_add(*RETVAL, *m, *n); OUTPUT: RETVAL mpz_t * sub_two(m,n) mpz_t * m mpz_t * n CODE: RETVAL = malloc (sizeof(mpz_t)); mpz_init(*RETVAL); mpz_sub(*RETVAL, *m, *n); OUTPUT: RETVAL mpz_t * mul_two(m,n) mpz_t * m mpz_t * n CODE: RETVAL = malloc (sizeof(mpz_t)); mpz_init(*RETVAL); mpz_mul(*RETVAL, *m, *n); OUTPUT: RETVAL mpz_t * div_two(m,n) mpz_t * m mpz_t * n CODE: RETVAL = malloc (sizeof(mpz_t)); mpz_init(*RETVAL); mpz_div(*RETVAL, *m, *n); OUTPUT: RETVAL void bdiv_two(m,n) mpz_t * m mpz_t * n PREINIT: mpz_t * quo; mpz_t * rem; PPCODE: quo = malloc (sizeof(mpz_t)); rem = malloc (sizeof(mpz_t)); mpz_init(*quo); mpz_init(*rem); mpz_tdiv_qr(*quo, *rem, *m, *n); EXTEND(SP, 2); PUSHs(sv_setref_pv(sv_newmortal(), "Math::GMP", (void*)quo)); PUSHs(sv_setref_pv(sv_newmortal(), "Math::GMP", (void*)rem)); mpz_t * mod_two(m,n) mpz_t * m mpz_t * n CODE: RETVAL = malloc (sizeof(mpz_t)); mpz_init(*RETVAL); mpz_mod(*RETVAL, *m, *n); OUTPUT: RETVAL int cmp_two(m,n) mpz_t * m mpz_t * n CODE: RETVAL = mpz_cmp(*m, *n); OUTPUT: RETVAL int gmp_legendre(m, n) mpz_t * m mpz_t * n CODE: RETVAL = mpz_legendre(*m, *n); OUTPUT: RETVAL int gmp_jacobi(m, n) mpz_t * m mpz_t * n CODE: RETVAL = mpz_jacobi(*m, *n); OUTPUT: RETVAL int gmp_probab_prime(m, reps) mpz_t * m int reps CODE: RETVAL = mpz_probab_prime_p(*m, reps); OUTPUT: RETVAL mpz_t * pow_two(m,n) mpz_t * m long n CODE: RETVAL = malloc (sizeof(mpz_t)); mpz_init(*RETVAL); /* fprintf(stderr, "n is %ld\n", n);*/ mpz_pow_ui(*RETVAL, *m, n); OUTPUT: RETVAL mpz_t * gcd_two(m,n) mpz_t * m mpz_t * n CODE: RETVAL = malloc (sizeof(mpz_t)); mpz_init(*RETVAL); mpz_gcd(*RETVAL, *m, *n); OUTPUT: RETVAL mpz_t * gmp_fib(n) long n CODE: RETVAL = malloc (sizeof(mpz_t)); mpz_init(*RETVAL); mpz_fib_ui(*RETVAL, n); OUTPUT: RETVAL mpz_t * and_two(m,n) mpz_t * m mpz_t * n CODE: RETVAL = malloc (sizeof(mpz_t)); mpz_init(*RETVAL); mpz_and(*RETVAL, *m, *n); OUTPUT: RETVAL mpz_t * xor_two(m,n) mpz_t * m mpz_t * n CODE: RETVAL = malloc (sizeof(mpz_t)); mpz_init(*RETVAL); mpz_xor(*RETVAL, *m, *n); OUTPUT: RETVAL mpz_t * or_two(m,n) mpz_t * m mpz_t * n CODE: RETVAL = malloc (sizeof(mpz_t)); mpz_init(*RETVAL); mpz_ior(*RETVAL, *m, *n); OUTPUT: RETVAL mpz_t * gmp_fac(n) long n CODE: RETVAL = malloc (sizeof(mpz_t)); mpz_init(*RETVAL); mpz_fac_ui(*RETVAL, n); OUTPUT: RETVAL mpz_t * gmp_copy(m) mpz_t * m CODE: RETVAL = malloc (sizeof(mpz_t)); mpz_init_set(*RETVAL, *m); OUTPUT: RETVAL int gmp_tstbit(m,n) mpz_t * m long n CODE: RETVAL = mpz_tstbit(*m,n); OUTPUT: RETVAL mpz_t * gmp_sqrt(m) mpz_t * m CODE: RETVAL = malloc (sizeof(mpz_t)); mpz_init(*RETVAL); mpz_sqrt(*RETVAL, *m); OUTPUT: RETVAL Math-GMP-2.06/t/0000755000076400007640000000000011254504621011660 5ustar greggregMath-GMP-2.06/t/01_gmppm.t0000644000076400007640000002140511072421632013465 0ustar greggreg#!perl use strict; use warnings; use Data::Dumper; use Math::GMP; use Test::More; use Config; my ($f,$try,$x,$y,$ans,@tests,@data,@args,$ans1,$z,$line); @data = ; @tests = grep { ! /^&/ } @data; plan tests => (scalar @tests + 2); while (defined($line = shift @data)) { chomp $line; if ($line =~ s/^&//) { $f = $line; next; } @args = split(/:/,$line,99); $ans = pop(@args); if ( $args[0] =~ /^i([-+]?\d+)$/ ) { $try = "\$x = $1;"; } elsif ( $args[0] =~ /^b([-+]?.+),([0-9]+)$/ ) { $try = "\$x = new Math::GMP \"$1\", $2;"; } else { $try = "\$x = new Math::GMP \"$args[0]\";"; } if ($f eq "bnorm") { $try .= "\$x+0;"; } elsif ($f eq "fibonacci") { $try .= 'Math::GMP::fibonacci($x);'; } elsif ($f eq "bfac") { $try .= '$x->bfac();'; } elsif ($f eq "bneg") { $try .= "-\$x;"; } elsif ($f eq "babs") { $try .= "abs \$x;"; } elsif ($f eq "square_root") { $try .= 'Math::GMP::gmp_sqrt($x);'; } elsif ($f eq 'uintify') { $try .= "Math::GMP::uintify_gmp(\$x);"; $ans = pop(@args) if ($Config{longsize} == 4 && scalar @args > 1); } elsif ($f eq 'intify') { $try .= "Math::GMP::intify_gmp(\$x);"; $ans = pop(@args) if ($Config{longsize} == 4 && scalar @args > 1); } elsif ($f eq 'probab_prime') { my $rets = $args[1]; $try .= "Math::GMP::gmp_probab_prime(\$x,$rets);"; } elsif ($f eq 'new_from_base') { $try .= "\$x;"; } else { if ( $args[1] =~ /^i([-+]?\d+)$/ ) { $try .= "\$y = $1;"; } else { $try .= "\$y = new Math::GMP \"$args[1]\";"; } if ($f eq 'bcmp') { $try .= "\$x <=> \$y;"; } elsif ($f eq 'band') { $try .= "\$x & \$y;"; } elsif ($f eq 'bxor') { $try .= "\$x ^ \$y;"; } elsif ($f eq 'bior') { $try .= "\$x | \$y;"; } elsif ($f eq 'badd') { $try .= "\$x + \$y;"; } elsif ($f eq 'bsub') { $try .= "\$x - \$y;"; } elsif ($f eq 'bmul') { $try .= "\$x * \$y;"; } elsif ($f eq 'bdiv') { $try .= "\$x / \$y;"; } elsif ($f eq 'bmod') { $try .= "\$x % \$y;"; } elsif ($f eq 'bdiv2a') { $try .= "((Math::GMP::bdiv(\$x, \$y))[0]);"; } elsif ($f eq 'bdiv2b') { $try .= "((Math::GMP::bdiv(\$x, \$y))[1]);"; } elsif ($f eq 'bgcd') { $try .= "Math::GMP::bgcd(\$x, \$y);"; } elsif ($f eq 'gcd') { $try .= "Math::GMP::gcd(\$x, \$y);"; } elsif ($f eq 'sizeinbase') { $try .= "Math::GMP::sizeinbase_gmp(\$x, \$y);"; } elsif ($f eq 'add_ui') { $try .= "Math::GMP::add_ui_gmp(\$x, \$y); \$x"; } elsif ($f eq 'mul_2exp') { $try .= "Math::GMP::mul_2exp_gmp(\$x, \$y);"; } elsif ($f eq 'div_2exp') { $try .= "Math::GMP::div_2exp_gmp(\$x, \$y);"; } elsif ($f eq 'mmod') { $try .= "Math::GMP::mmod_gmp(\$x, \$y);"; } elsif ($f eq 'mod_2exp') { $try .= "Math::GMP::mod_2exp_gmp(\$x, \$y);"; } elsif ($f eq 'legendre') { $try .= "Math::GMP::legendre(\$x, \$y);"; } elsif ($f eq 'jacobi') { $try .= "Math::GMP::jacobi(\$x, \$y);"; } elsif ($f eq 'test_bit') { $try .= "Math::GMP::gmp_tstbit(\$x, \$y);"; } else { if ( $args[2] =~ /^i([-+]?\d+)$/ ) { $try .= "\$z = $1;"; } else { $try .= "\$z = new Math::GMP \"$args[2]\";"; } if ($f eq 'powm') { $try .= "Math::GMP::powm_gmp(\$x, \$y, \$z);"; } else { warn "Unknown op"; } } } $ans1 = eval $try; is( "$ans1", $ans, "Test worked: $try"); } # some assorted tests for internal functions $x = Math::GMP->new('123'); $y = Math::GMP::gmp_copy($x); is (ref($y),ref($x), 'refs are the same'); is ("$y",'123', 'gmp_copy gives correct value'); # all done __END__ &bcmp +0:0:0 -1:0:-1 +0:-1:1 +1:0:1 +0:1:-1 -1:1:-1 +1:-1:1 -1:-1:0 +1:1:0 +123:123:0 +123:12:1 +12:123:-1 -123:-123:0 -123:-12:-1 -12:-123:1 +123:124:-1 +124:123:1 -123:-124:1 -124:-123:-1 +100:5:1 i+100:5:1 +100:i5:1 i-10:-10:0 &badd +0:0:0 +1:0:1 +0:1:1 +1:1:2 -1:0:-1 +0:-1:-1 -1:-1:-2 -1:1:0 +1:-1:0 +9:1:10 +99:1:100 +999:1:1000 +9999:1:10000 +99999:1:100000 +999999:1:1000000 +9999999:1:10000000 i+9999999:1:10000000 +99999999:1:100000000 +999999999:1:1000000000 +9999999999:1:10000000000 +99999999999:1:100000000000 +99999999999:i1:100000000000 +10:-1:9 +100:-1:99 +1000:-1:999 +10000:-1:9999 +100000:-1:99999 +1000000:-1:999999 +10000000:-1:9999999 +100000000:-1:99999999 +1000000000:-1:999999999 +10000000000:-1:9999999999 +123456789:987654321:1111111110 -123456789:987654321:864197532 -123456789:-987654321:-1111111110 +123456789:-987654321:-864197532 &bsub +0:0:0 +1:0:1 +0:1:-1 +1:1:0 -1:0:-1 +0:-1:1 -1:-1:0 -1:1:-2 +1:-1:2 +9:1:8 +99:1:98 +999:1:998 +9999:1:9998 +99999:1:99998 +999999:1:999998 +9999999:1:9999998 +99999999:1:99999998 +999999999:1:999999998 +9999999999:1:9999999998 +99999999999:1:99999999998 +99999999999:i1:99999999998 +10:-1:11 +100:-1:101 +1000:-1:1001 +10000:-1:10001 +100000:-1:100001 +1000000:-1:1000001 +10000000:-1:10000001 +100000000:-1:100000001 +1000000000:-1:1000000001 +10000000000:-1:10000000001 +123456789:987654321:-864197532 -123456789:987654321:-1111111110 -123456789:-987654321:864197532 +123456789:-987654321:1111111110 i4:12345678987:-12345678983 &bmul +0:0:0 +0:1:0 +1:0:0 +0:-1:0 -1:0:0 +123456789123456789:0:0 +0:123456789123456789:0 -1:-1:1 -1:1:-1 +1:-1:-1 +1:1:1 +2:3:6 -2:3:-6 +2:-3:-6 -2:-3:6 +111:111:12321 +10101:10101:102030201 +1001001:1001001:1002003002001 +100010001:100010001:10002000300020001 +10000100001:10000100001:100002000030000200001 +11111111111:9:99999999999 +11111111111:i9:99999999999 i9:+11111111111:99999999999 +22222222222:9:199999999998 +33333333333:9:299999999997 +44444444444:9:399999999996 +55555555555:9:499999999995 +66666666666:9:599999999994 +77777777777:9:699999999993 +88888888888:9:799999999992 +99999999999:9:899999999991 &bdiv2a +0:1:0 +0:-1:0 +1:1:1 -1:-1:1 +1:-1:-1 -1:1:-1 +1:2:0 +2:1:2 +1000000000:9:111111111 +1000000000:i9:111111111 +2000000000:9:222222222 +3000000000:9:333333333 +4000000000:9:444444444 +5000000000:9:555555555 +6000000000:9:666666666 +7000000000:9:777777777 +8000000000:9:888888888 +9000000000:9:1000000000 +35500000:113:314159 +71000000:226:314159 +106500000:339:314159 +1000000000:3:333333333 +10:5:2 +100:4:25 +1000:8:125 +10000:16:625 i+10000:16:625 +999999999999:9:111111111111 +999999999999:99:10101010101 +999999999999:999:1001001001 +999999999999:9999:100010001 +999999999999999:99999:10000100001 &bdiv +0:1:0 +0:-1:0 +1:1:1 -1:-1:1 +1:-1:-1 -1:1:-1 +1:2:0 +2:1:2 +1000000000:9:111111111 +1000000000:i9:111111111 +2000000000:9:222222222 +3000000000:9:333333333 +4000000000:9:444444444 +5000000000:9:555555555 +6000000000:9:666666666 +7000000000:9:777777777 +8000000000:9:888888888 +9000000000:9:1000000000 +35500000:113:314159 +71000000:226:314159 +106500000:339:314159 +1000000000:3:333333333 +10:5:2 +100:4:25 +1000:8:125 +10000:16:625 i+10000:16:625 +999999999999:9:111111111111 +999999999999:99:10101010101 +999999999999:999:1001001001 +999999999999:9999:100010001 +999999999999999:99999:10000100001 &bdiv2b +0:1:0 +0:-1:0 +1:1:0 -1:-1:0 +1:-1:0 -1:1:0 +1:2:1 +2:1:0 +1000000000:9:1 +1000000000:i9:1 +2000000000:9:2 +3000000000:9:3 +4000000000:9:4 +5000000000:9:5 +6000000000:9:6 +7000000000:9:7 +8000000000:9:8 +9000000000:9:0 +35500000:113:33 i+35500000:113:33 +71000000:226:66 +106500000:339:99 +1000000000:3:1 +10:5:0 +100:4:0 +1000:8:0 +10000:16:0 +999999999999:9:0 +999999999999:99:0 +999999999999:999:0 +999999999999:9999:0 +999999999999999:99999:0 &bmod +0:1:0 +0:-1:0 +1:1:0 -1:-1:0 +1:-1:0 -1:1:0 +1:2:1 +2:1:0 +1000000000:9:1 +1000000000:i9:1 +2000000000:9:2 +3000000000:9:3 +4000000000:9:4 +5000000000:9:5 +6000000000:9:6 +7000000000:9:7 +8000000000:9:8 +9000000000:9:0 +35500000:113:33 i+35500000:113:33 +71000000:226:66 +106500000:339:99 +1000000000:3:1 +10:5:0 +100:4:0 +1000:8:0 +10000:16:0 +999999999999:9:0 +999999999999:99:0 +999999999999:999:0 +999999999999:9999:0 +999999999999999:99999:0 &bgcd +0:0:0 +0:1:1 +1:0:1 +1:1:1 +2:3:1 +3:2:1 +100:625:25 +4096:81:1 &gcd +0:0:0 +0:1:1 +1:0:1 +1:1:1 +2:3:1 +3:2:1 +100:625:25 +4096:81:1 &new_from_base 0xff:255 0x2395fa:2332154 babcdefgh,36:808334348993 &sizeinbase +5:i10:1 +9999999999:i16:9 -5000:i2:13 &uintify +15:15 +9999999999:1410065407:9999999999 +99999999999:1215752191:99999999999 +999999999999:3567587327:999999999999 &add_ui +999999:i1:1000000 +9999999:i1:10000000 +99999999:i1:100000000 &intify +999999999:999999999 +9999999999:1410065407:9999999999 &mul_2exp +9999:i9:5119488 +99999:i9:51199488 +0:i1:0 +1:i0:1 &div_2exp +999999:i1111:0 +0:i1:0 &powm +99999:999999:99:27 +1:1:1:0 +1:0:1:0 &mmod +99999:100002:99999 +1:1:0 &mod_2exp +99999999:11111:99999999 +0:1:0 &jacobi +1:15:1 +1:15:1 +2:15:1 +3:15:0 +4:15:1 +5:15:0 +6:15:0 +7:15:-1 +8:15:1 +9:15:0 +10:15:0 +11:15:-1 +12:15:0 +13:15:-1 +14:15:-1 +15:15:0 &band 7:3:3 2:3:2 4:1:0 &bxor 7:3:4 2:3:1 4:1:5 &bior 7:3:7 2:3:3 4:1:5 &bfac 1:1 2:2 3:6 4:24 5:120 6:720 &fibonacci 2:1 3:2 4:3 5:5 6:8 7:13 8:21 9:34 10:55 &test_bit 10:0:0 1:0:1 3:1:1 3:2:0 &square_root 16:4 1:1 0:0 100:10 101:10 99:9 &probab_prime 5:10:2 6:10:0 Math-GMP-2.06/t/99_yaml.t0000644000076400007640000000124311254504406013331 0ustar greggreg#!perl ## Test META.yml for YAMLiciousness, requires Test::YAML::Meta use 5.006; use strict; use warnings; use Test::More; select(($|=1,select(STDERR),$|=1)[1]); if (! $ENV{RELEASE_TESTING}) { plan (skip_all => 'Test skipped unless environment variable RELEASE_TESTING is set'); } plan tests => 2; my $V = 0.03; eval { require Test::YAML::Meta; Test::YAML::Meta->import; }; if ($@) { SKIP: { skip ('Skipping Test::YAML::Meta tests: module not found', 2); } } elsif ($Test::YAML::Meta::VERSION < $V) { SKIP: { skip ("Skipping Test::YAML::Meta tests: need version $V, but only have $Test::YAML::Meta::VERSION", 2); } } else { meta_spec_ok ('META.yml', 1.4); } Math-GMP-2.06/t/00_signature.t0000644000076400007640000000134411254504366014355 0ustar greggreg#!perl ## Test that our SIGNATURE file is valid use 5.006; use strict; use warnings; use Test::More; select(($|=1,select(STDERR),$|=1)[1]); if (! $ENV{RELEASE_TESTING}) { plan (skip_all => 'Test skipped unless environment variable RELEASE_TESTING is set'); } plan tests => 1; SKIP: { if (!eval { require Module::Signature; 1 }) { skip ('Must have Module::Signature to test SIGNATURE file', 1); } elsif ( !-e 'SIGNATURE' ) { fail ('SIGNATURE file was not found'); } elsif ( ! -s 'SIGNATURE') { fail ('SIGNATURE file was empty'); } else { my $ret = Module::Signature::verify(); if ($ret eq Module::Signature::SIGNATURE_OK()) { pass ('Valid SIGNATURE file'); } else { fail ('Invalid SIGNATURE file'); } } } Math-GMP-2.06/t/99_pod.t0000644000076400007640000000174711254504427013165 0ustar greggreg#!perl ## Check our Pod, requires Test::Pod ## Also done if available: Test::Pod::Coverage use 5.006; use strict; use warnings; use Test::More; select(($|=1,select(STDERR),$|=1)[1]); if (! $ENV{RELEASE_TESTING}) { plan (skip_all => 'Test skipped unless environment variable RELEASE_TESTING is set'); } plan tests => 2; my $PODVERSION = '0.95'; eval { require Test::Pod; Test::Pod->import; }; SKIP: { if ($@ or $Test::Pod::VERSION < $PODVERSION) { skip ("Test::Pod $PODVERSION is required", 1); } pod_file_ok ('lib/Math/GMP.pm'); } ## We won't require everyone to have this, so silently move on if not found my $PODCOVERVERSION = '1.04'; eval { require Test::Pod::Coverage; Test::Pod::Coverage->import; }; SKIP: { if ($@ or $Test::Pod::Coverage::VERSION < $PODCOVERVERSION) { skip ("Test::Pod::Coverage $PODCOVERVERSION is required", 1); } my $trusted_names = [ ]; my $t='Math::GMP pod coverage okay'; pod_coverage_ok ('Math::GMP', {trustme => $trusted_names}, $t); } Math-GMP-2.06/t/99_spellcheck.t0000644000076400007640000000653511254504304014512 0ustar greggreg#!perl ## Spellcheck as much as we can use 5.006; use strict; use warnings; use Test::More; select(($|=1,select(STDERR),$|=1)[1]); my (@testfiles, @perlfiles, @textfiles, @commentfiles, $fh); if (! $ENV{RELEASE_TESTING}) { plan (skip_all => 'Test skipped unless environment variable RELEASE_TESTING is set'); } elsif (!eval { require Text::SpellChecker; 1 }) { plan skip_all => 'Could not find Text::SpellChecker'; } else { opendir my $dir, 't' or die qq{Could not open directory 't': $!\n}; @testfiles = map { "t/$_" } grep { /^.+\.(t|pl)$/ } readdir $dir; closedir $dir or die qq{Could not closedir "$dir": $!\n}; open my $fh, '<', 'MANIFEST' or die qq{Could not open the MANIFEST file: $!\n}; while (<$fh>) { next unless /(.*\.pm)/; push @perlfiles, $1; } close $fh or die qq{Could not close the MANIFEST file: $!\n}; @textfiles = qw/README Changes LICENSE/; @commentfiles = (@testfiles, 'Makefile.PL', @perlfiles); plan tests => @textfiles + @perlfiles + @commentfiles; } my %okword; my $file = 'Common'; while () { if (/^## (.+):/) { $file = $1; next; } next if /^#/ or ! /\w/; for (split) { $okword{$file}{$_}++; } } sub spellcheck { my ($desc, $text, $sfile) = @_; my $check = Text::SpellChecker->new(text => $text); my %badword; my $class = $sfile =~ /\.pm$/ ? 'Perl' : $sfile =~ /\.t$/ ? 'Test' : ''; while (my $word = $check->next_word) { next if $okword{Common}{$word} or $okword{$sfile}{$word} or $okword{$class}{$word}; $badword{$word}++; } my $count = keys %badword; if (! $count) { pass ("Spell check passed for $desc"); return; } fail ("Spell check failed for $desc. Bad words: $count"); for (sort keys %badword) { diag "$_\n"; } return; } ## General spellchecking for my $file (@textfiles) { if (!open $fh, '<', $file) { fail (qq{Could not find the file "$file"!}); } else { { local $/; $_ = <$fh>; } close $fh or warn qq{Could not close "$file": $!\n}; spellcheck ($file => $_, $file); } } ## Now the embedded POD SKIP: { if (!eval { require Pod::Spell; 1 }) { my $files = @perlfiles; skip ('Need Pod::Spell to test the spelling of embedded POD', $files); } for my $file (@perlfiles) { if (! -e $file) { fail (qq{Could not find the file "$file"!}); } my $string = qx{podspell $file}; spellcheck ("POD from $file" => $string, $file); } } ## Now the comments SKIP: { if (!eval { require File::Comments; 1 }) { my $files = @commentfiles; skip ('Need File::Comments to test the spelling inside comments', $files); } my $fc = File::Comments->new(); for my $file (@commentfiles) { if (! -e $file) { fail (qq{Could not find the file "$file"!}); } my $string = $fc->comments($file); if (! $string) { fail (qq{Could not get comments from file $file}); next; } $string = join "\n" => @$string; $string =~ s/=head1.+//sm; spellcheck ("comments from $file" => $string, $file); } } __DATA__ ## These words are okay ## Common: babcdefgh badd bcmp bdiv bfac bgcd Biggar BigInt bior bloodgate bmod bmul bsub bxor chipt cpan CPAN cturner Divisior dk env fac fibonacci gcd gmp GMP GMP gmppmt Ilya intify jacobi legendre Makefile mmod mul Mullane namespace nicholas n'th ok Oxh oxhoej perl perl powm README redhat Sabino Sep sizeinbase Spellcheck spellchecking sqrt tradeoff tstbit ui uintify xff xs YAML YAMLiciousness yml Zakharevich ## Changes iglu il libgmp probab shlomif Math-GMP-2.06/t/99_perlcritic.t0000644000076400007640000001010411254504334014523 0ustar greggreg#!perl ## Run Perl::Critic against the source code and the tests ## This is highly customized, so take with a grain of salt use 5.006; use strict; use warnings; use Test::More; use Data::Dumper; select(($|=1,select(STDERR),$|=1)[1]); my (@testfiles, @perlfiles, %fileslurp, $t); if (! $ENV{RELEASE_TESTING}) { plan (skip_all => 'Test skipped unless environment variable RELEASE_TESTING is set'); } elsif (!eval { require Perl::Critic; 1 }) { plan skip_all => 'Could not find Perl::Critic'; } elsif ($Perl::Critic::VERSION < 0.23) { plan skip_all => 'Perl::Critic must be version 0.23 or higher'; } else { opendir my $dir, 't' or die qq{Could not open directory 't': $!\n}; @testfiles = map { "t/$_" } grep { /^.+\.(t|pl)$/ } readdir $dir; closedir $dir or die qq{Could not closedir "$dir": $!\n}; open my $fh, '<', 'MANIFEST' or die qq{Could not open the MANIFEST file: $!\n}; while (<$fh>) { next unless /(.*\.pm)/; push @perlfiles, $1; } close $fh or die qq{Could not close the MANIFEST file: $!\n}; plan tests => 2 + @perlfiles + @testfiles; } ok (@testfiles, 'Found files in test directory'); ## Check some non-test files my $critic = Perl::Critic->new(-severity => 1); for my $filename (@perlfiles) { if ($ENV{TEST_CRITIC_SKIPNONTEST}) { pass (qq{Skipping non-test file "$filename"}); next; } -e $filename or die qq{Could not find "$filename"!}; open my $oldstderr, '>&', \*STDERR or die 'Could not dupe STDERR'; close STDERR or die qq{Could not close STDERR: $!}; my @vio = $critic->critique($filename); open STDERR, '>&', $oldstderr or die 'Could not recreate STDERR'; ## no critic close $oldstderr or die qq{Could not close STDERR copy: $!}; my $vios = 0; VIO: for my $v (@vio) { my $d = $v->description(); (my $policy = $v->policy()) =~ s/Perl::Critic::Policy:://; my $source = $v->source(); ## Allow our sql and qw blocks to have tabs: next if $policy =~ /ProhibitHardTabs/ and ($source =~ /sql = qq/i or $source =~ /qw[\(\/]/); $vios++; my $f = $v->filename(); my $l = $v->location(); my $line = $l->[0]; diag "\nFile: $f (line $line)\n"; diag "Vio: $d\n"; diag "Policy: $policy\n"; diag "Source: $source\n\n"; } if ($vios) { fail (qq{Failed Perl::Critic tests for file "$filename": $vios}); } else { pass (qq{File "$filename" passed all Perl::Critic tests}); } } ## Specific exclusions for test scripts: my %ok = (yaml => { sub => 'meta_spec_ok', }, pod => { sub => 'pod_file_ok pod_coverage_ok', }, signature => { sub => 'verify SIGNATURE_OK', }, ); for my $f (keys %ok) { for my $ex (keys %{$ok{$f}}) { if ($ex eq 'sub') { for my $foo (split /\s+/ => $ok{$f}{sub}) { push @{$ok{$f}{OK}} => qr{Subroutine "$foo" (?:is neither|not exported)}; } } else { die "Unknown exception '$ex'\n"; } } } ## Allow Test::More subroutines my $tm = join '|' => (qw/skip plan pass fail is ok diag BAIL_OUT/); my $testmoreok = qr{Subroutine "$tm" is neither}; ## Create a new critic for the tests $critic = Perl::Critic->new(-severity => 1); my $count = 1; for my $filename (sort @testfiles) { -e $filename or die qq{Could not find "$filename"!}; my @vio = $critic->critique($filename); my $vios = 0; VIO: for my $v (@vio) { my $d = $v->description(); (my $policy = $v->policy()) =~ s/Perl::Critic::Policy:://; my $source = $v->source(); my $f = $v->filename(); ## Skip common Test::More subroutines: next if $d =~ $testmoreok; next if $policy =~ /RequireVersionVar/; ## Skip other specific items: for my $k (sort keys %ok) { next unless $f =~ /$k/; for (@{$ok{$k}{OK}}) { next VIO if $d =~ $_; } } ## Skip included file package warning next if $policy =~ /RequireExplicitPackage/ and $filename =~ /setup/; $vios++; my $l = $v->location(); my $line = $l->[0]; diag "\nFile: $f (line $line)\n"; diag "Vio: $d\n"; diag "Policy: $policy\n"; diag "Source: $source\n\n"; } if ($vios) { fail (qq{Failed Perl::Critic tests for file "$filename": $vios}); } else { pass (qq{File "$filename" passed all Perl::Critic tests}); } } pass ('Finished Perl::Critic testing'); Math-GMP-2.06/INSTALL0000644000076400007640000000217111254501651012447 0ustar greggregMath::GMP - High speed arbitrary size integer math To install this package, you will need a version of the GMP library. You can get it at the homepage of GMP: http://www.gmplib.org/ After installing GMP, do the following: perl Makefile.PL make make test When all tests pass, install it (as root) with the following command: make install Enjoy! If you have problems, please check the platform-specific notes below. ** Notes for AIX ** tswd13@yahoo.com notes on bug #11736 about installing on AIX 5.2: First, I had to modify the Makefile.PL so that it could see the gmp libraries by adding "-L/usr/local/lib" as below: 'LIBS' => ['-L/usr/local/lib -lgmp'], # e.g., '-lm' Then, I had to change the following line in GMP.c and GMP.xs from: #include "gmp.h" to: #include Reinstalled gmp-4.1.4 with: ./configure ABI=32 --disable-static ** Notes for OSX ** Rob writes on bug #19262: Error: /usr/bin/ld: /usr/local/lib/libgmp.a(mode1o.o) has local relocation entries in non-writable section (__TEXT,__text) Solution: Edit the Makefile, adding the following to LDDLFLAGS: -read_only_relocs suppress Math-GMP-2.06/META.yml0000644000076400007640000000236411254503161012671 0ustar greggreg--- #YAML:1.0 name : Math-GMP version : 2.06 abstract : High speed arbitrary size integer math author: - Chip Turner - Tels - Greg Sabino Mullane license : gpl distribution_type : module dynamic_config : 1 build_requires: Test::More : 0.61 recommends: File::Comments : 0 Module::Signature : 0.50 Perl::Critic : 0 Pod::Spell : 0 Test::Pod : 0.95 Test::Pod::Coverage : 0 Test::YAML::Meta : 0.03 Text::SpellChecker : 0 provides: Math::GMP: file : GMP.pm version : 2.06 keywords: - math - bigint - gmp - integer resources: homepage : http://search.cpan.org/dist/Math-GMP/ license : http://dev.perl.org/licenses/ bugtracker : http://rt.cpan.org/Public/Dist/Display.html?Name=Math-GMP meta-spec: version : 1.4 url : http://module-build.sourceforge.net/META-spec-v1.4.html generated_by : emacs Math-GMP-2.06/lib/0000755000076400007640000000000011254504621012163 5ustar greggregMath-GMP-2.06/lib/Math/0000755000076400007640000000000011254504621013054 5ustar greggregMath-GMP-2.06/lib/Math/GMP.pm0000644000076400007640000002210311254503323014031 0ustar greggregpackage Math::GMP; # Math::GMP, a Perl module for high-speed arbitrary size integer # calculations # Copyright (C) 2000-2008 James H. Turner # Copyright (C) 2008-2009 Greg Sabino Mullane # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Library General Public # License as published by the Free Software Foundation; either # version 2 of the License, or (at your option) any later version. # 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. See the GNU # Library General Public License for more details. # You should have received a copy of the GNU Library General Public # License along with this library; if not, write to the Free # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # You can contact the author at chip@redhat.com, chipt@cpan.org, or by mail: # Chip Turner # Red Hat Inc. # 2600 Meridian Park Blvd # Durham, NC 27713 use strict; use warnings; use 5.006; use Carp; use vars qw($VERSION @ISA @EXPORT @EXPORT_OK $AUTOLOAD); use overload '""' => \&stringify, '0+' => \&intify, '<=>' => \&op_spaceship, 'cmp' => \&op_cmp, '+' => \&op_add, '-' => \&op_sub, '&' => \&op_and, '^' => \&op_xor, '|' => \&op_or, '%' => \&op_mod, '**' => \&op_pow, '*' => \&op_mul, '/' => \&op_div; require Exporter; require DynaLoader; require AutoLoader; @ISA = qw(Exporter DynaLoader); # Items to export into callers namespace by default. Note: do not export # names by default without a very good reason. Use EXPORT_OK instead. # Do not simply export all your public functions/methods/constants. our $VERSION = '2.06'; sub AUTOLOAD { # This AUTOLOAD is used to 'autoload' constants from the constant() # XS function. If a constant is not found then control is passed # to the AUTOLOAD in AutoLoader. my $constname; ($constname = $AUTOLOAD) =~ s/.*:://; croak '& not defined' if $constname eq 'constant'; my $val = constant($constname, @_ ? $_[0] : 0); if ($! != 0) { if ($! =~ /Invalid/) { $AutoLoader::AUTOLOAD = $AUTOLOAD; goto &AutoLoader::AUTOLOAD; } else { croak "Your vendor has not defined Math::GMP macro $constname"; } } no strict 'refs'; ## no critic *$AUTOLOAD = sub () { $val }; goto &$AUTOLOAD; } bootstrap Math::GMP $VERSION; use strict; sub import { shift; return unless @_; die "unknown import: @_" unless @_ == 1 and $_[0] eq ':constant'; overload::constant integer => sub { Math::GMP->new(shift) }; return; } sub new { my $class = shift; my $ival = shift || 0; my $base = shift; $ival =~ s/^\+//; $ival =~ s/[ _]//g; my $ret; if ($base) { $ret = Math::GMP::new_from_scalar_with_base($ival, $base); } else { $ival = 0 if $ival =~ /[^\d\-xA-Fa-f]/; $ret = Math::GMP::new_from_scalar($ival); } return $ret; } BEGIN { *DESTROY = \&Math::GMP::destroy; } sub add { croak 'add: not enough arguments, two required' if @_ < 2; my $ret = Math::GMP->new(0); add_to_self($ret, shift) while @_; return $ret; } sub stringify { return Math::GMP::stringify_gmp($_[0]); } sub intify { return Math::GMP::intify_gmp($_[0]); } sub promote { return $_[0] if ref $_[0] eq 'Math::GMP'; return Math::GMP::new_from_scalar($_[0] || 0); } sub gcd { return gcd_two(promote(shift), promote(shift)); } sub bgcd { return gcd_two(promote(shift), promote(shift)); } sub legendre { return gmp_legendre(promote(shift), promote(shift)); } sub jacobi { return gmp_jacobi(promote(shift), promote(shift)); } sub probab_prime { my $x = shift; my $reps = shift; return gmp_probab_prime(promote($x), $reps); } sub op_add { my ($n, $m) = @_; ($n, $m) = ($m, $n) if $_[2]; return add_two(promote($n), promote($m)); } sub op_sub { my ($n, $m) = @_; ($n, $m) = ($m, $n) if $_[2]; return sub_two(promote($n), promote($m)); } sub op_mul { my ($n, $m) = @_; ($n, $m) = ($m, $n) if $_[2]; return mul_two(promote($n), promote($m)); } sub op_div { my ($n, $m) = @_; ($n, $m) = ($m, $n) if $_[2]; return div_two(promote($n), promote($m)); } sub bdiv { return bdiv_two(promote(shift), promote(shift)); } sub op_mod { my ($n, $m) = @_; ($n, $m) = ($m, $n) if $_[2]; return mod_two(promote($n), promote($m)); } sub op_cmp { my ($n, $m) = @_; ($n, $m) = ($m, $n) if $_[2]; return cmp_two(stringify(promote($n)), stringify(promote($m))); } sub op_spaceship { my ($n, $m) = @_; ($n, $m) = ($m, $n) if $_[2]; my $x = cmp_two(promote($n), promote($m)); return $x < 0 ? -1 : $x > 0 ? 1 : 0; } sub op_pow { my ($m, $n) = @_; ($n, $m) = ($m, $n) if $_[2]; return pow_two(promote($m), int($n)); } sub op_and { my ($n, $m) = @_; ($n, $m) = ($m, $n) if $_[2]; return and_two(promote($n), promote($m)); } sub op_xor { my ($n, $m) = @_; ($n, $m) = ($m, $n) if $_[2]; return xor_two(promote($n), promote($m)); } sub op_or { my ($n, $m) = @_; ($n, $m) = ($m, $n) if $_[2]; return or_two(promote($n), promote($m)); } sub bior { return or_two(promote(shift), promote(shift)); } sub band { return and_two(promote(shift), promote(shift)); } sub bxor { return xor_two(promote(shift), promote(shift)); } sub bfac { return gmp_fac(int(shift)); } sub fibonacci { return gmp_fib(int(shift)); } __END__ =head1 NAME Math::GMP - High speed arbitrary size integer math =head1 SYNOPSIS use Math::GMP; my $n = new Math::GMP 2; $n = $n ** (256*1024); $n = $n - 1; print "n is now $n\n"; =head1 DESCRIPTION Math::GMP was designed to be a drop-in replacement both for Math::BigInt and for regular integer arithmetic. Unlike BigInt, though, Math::GMP uses the GNU gmp library for all of its calculations, as opposed to straight Perl functions. This can result in speed improvements. The downside is that this module requires a C compiler to install -- a small tradeoff in most cases. Also, this module is not 100% compatible to Math::BigInt. A Math::GMP object can be used just as a normal numeric scalar would be -- the module overloads most of the normal arithmetic operators to provide as seamless an interface as possible. However, if you need a perfect interface, you can do the following: use Math::GMP qw(:constant); $n = 2 ** (256 * 1024); print "n is $n\n"; This would fail without the ':constant' since Perl would use normal doubles to compute the 250,000 bit number, and thereby overflow it into meaninglessness (smaller exponents yield less accurate data due to floating point rounding). =head1 METHODS Although the non-overload interface is not complete, the following functions do exist: =head2 new $x = Math::GMP->new(123); Creates a new Math::GMP object from the passed string or scalar. $x = Math::GMP->new('abcd', 36); Creates a new Math::GMP object from the first parameter which should be represented in the base specified by the second parameter. =head2 bfac $x = Math::GMP->new(5); $x->bfac(); # 1*2*3*4*5 = 120 Calculates the factorial of $x and modifies $x to contain the result. =head2 band $x = Math::GMP->new(6); $x->band(3); # 0b110 & 0b11 = 1 Calculates the bit-wise AND of it's two arguments and modifies the first argument. =head2 bxor $x = Math::GMP->new(6); $x->bxor(3); # 0b110 & 0b11 = 0b101 Calculates the bit-wise XOR of it's two arguments and modifies the first argument. =head2 bior $x = Math::GMP->new(6); $x->bior(3); # 0b110 & 0b11 = 0b111 Calculates the bit-wise OR of it's two arguments and modifies the first argument. =head2 bgcd $x = Math::GMP->new(6); $x->bgcd(4); # 6 / 2 = 2, 4 / 2 = 2 => 2 Calculates the Greatest Common Divisior of it's two arguments and returns the result. =head2 legendre =head2 jacobi =head2 fibonacci $x = Math::GMP->fibonacci(16); Calculates the n'th number in the Fibonacci sequence. =head2 probab_prime $x = Math::GMP->new(7); $x->probab_prime(10); Probabilistically Determines if the number is a prime. Argument is the number of checks to perform. Returns 0 if the number is definitely not a prime, 1 if it may be, and 2 if it is definitely is a prime. =head1 BUGS As of version 1.0, Math::GMP is mostly compatible with the old Math::BigInt version. It is not a full replacement for the rewritten Math::BigInt versions, though. See the L on how to achieve to use Math::GMP and retain full compatibility to Math::BigInt. There are some slight incompatibilities, such as output of positive numbers not being prefixed by a '+' sign. This is intentional. There are also some things missing, and not everything might work as expected. =head1 SEE ALSO Math::BigInt has a new interface to use a different library than the default pure Perl implementation. You can use, for instance, Math::GMP with it: use Math::BigInt lib => 'GMP'; If Math::GMP is not installed, it will fall back to it's own Perl implementation. See L and L or L or L. =head1 AUTHOR Chip Turner , based on the old Math::BigInt by Mark Biggar and Ilya Zakharevich. Further extensive work provided by Tels . =cut Math-GMP-2.06/MANIFEST0000644000076400007640000000034711072417530012552 0ustar greggregCOPYING.LIB INSTALL README LICENSE Changes lib/Math/GMP.pm GMP.xs MANIFEST MANIFEST.SKIP SIGNATURE META.yml Makefile.PL typemap t/00_signature.t t/01_gmppm.t t/99_perlcritic.t t/99_pod.t t/99_spellcheck.t t/99_yaml.t .perlcriticrc Math-GMP-2.06/SIGNATURE0000644000076400007640000000340511254504544012707 0ustar greggregThis file contains message digests of all files listed in MANIFEST, signed via the Module::Signature module, version 0.55. To verify the content in this distribution, first make sure you have Module::Signature installed, then type: % cpansign -v It will check each file's integrity, as well as the signature's validity. If "==> Signature verified OK! <==" is not displayed, the distribution may already have been compromised, and you should not run its Makefile.PL or Build.PL. -----BEGIN PGP SIGNED MESSAGE----- Hash: RIPEMD160 SHA1 19ac9eb1570ace4d76b4feed902e029b0bb68d16 .perlcriticrc SHA1 b256632dcce76559734ff0a23330d2898b7d3a3b COPYING.LIB SHA1 8253eaa1e8d27a15bd6dfee6d13c0d282917403f Changes SHA1 774d04b18b8f278e75c076f9415d8dd85eeaf3e5 GMP.xs SHA1 7b08e2399ff1482d96021f71e4387ca862da7051 INSTALL SHA1 505b15d429518390a904f67c0a16b30421b27513 LICENSE SHA1 301b1947e31dbe270c16df71aa99ece03c265b68 MANIFEST SHA1 4a2159b28844ebc0806319037665a0796defd6d7 MANIFEST.SKIP SHA1 d922720a434a29eb269243c52927ea6030cbeead META.yml SHA1 af828e1dea3a7207b8d45c0acd64d89e902bf42d Makefile.PL SHA1 8da9eb1c4f045bcc228f4ee68e026ff0a53a0187 README SHA1 cde240ee7250ec81754f5f8f1248be0238bf00cd lib/Math/GMP.pm SHA1 c6d5b40068571194f3d6718dad8d8f500e91498a t/00_signature.t SHA1 8e1dd95281414579132b797c10c1e9a35d2b6d01 t/01_gmppm.t SHA1 6479bc4bcf09fb9876fc52e2c02a91d9452c3018 t/99_perlcritic.t SHA1 9e5d32b76d38bf139b4798e16859fd484769fcf9 t/99_pod.t SHA1 8c0bbafd6411fc80df153fb01ada46960e6d0b59 t/99_spellcheck.t SHA1 762b0b761deaff9c2821400917698ded8983cc65 t/99_yaml.t SHA1 9686bf338037ae19ef5dad7cd4dc8e5edbe02722 typemap -----BEGIN PGP SIGNATURE----- iEYEAREDAAYFAkqyiWQACgkQvJuQZxSWSsiOQwCg+c7DSOBlXYuNkvAPA1YCrwap M/8AnjrJQcvcKX+WaB+/GVfRdqQOjWOT =jjsW -----END PGP SIGNATURE----- Math-GMP-2.06/typemap0000644000076400007640000000044110126260246013015 0ustar greggregmpz_t * MPZ INPUT MPZ if (sv_derived_from($arg, \"Math::GMP\")) { IV tmp = SvIV((SV*)SvRV($arg)); $var = ($type) tmp; } else croak(\"$var is not of type Math::GMP\") OUTPUT MPZ sv_setref_pv($arg, \"Math::GMP\", (void*)$var); Math-GMP-2.06/MANIFEST.SKIP0000644000076400007640000000015311072423742013314 0ustar greggreg^Makefile$ ^Makefile.old$ ^blib ~$ ^MANIFEST\.SKIP$ \.tmp$ ^tmp/* RCS/* GMP.o GMP.bs GMP.c pm_to_blib .gz$ Math-GMP-2.06/COPYING.LIB0000644000076400007640000006127310126260247013066 0ustar greggreg GNU LIBRARY GENERAL PUBLIC LICENSE Version 2, June 1991 Copyright (C) 1991 Free Software Foundation, Inc. 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. [This is the first released version of the library GPL. It is numbered 2 because it goes with version 2 of the ordinary GPL.] Preamble The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU General Public Licenses are intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users. This license, the Library General Public License, applies to some specially designated Free Software Foundation software, and to any other libraries whose authors decide to use it. You can use it for your libraries, too. When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for this service if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs; and that you know you can do these things. To protect your rights, we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights. These restrictions translate to certain responsibilities for you if you distribute copies of the library, or if you modify it. For example, if you distribute copies of the library, whether gratis or for a fee, you must give the recipients all the rights that we gave you. You must make sure that they, too, receive or can get the source code. If you link a program with the library, you must provide complete object files to the recipients so that they can relink them with the library, after making changes to the library and recompiling it. And you must show them these terms so they know their rights. Our method of protecting your rights has two steps: (1) copyright the library, and (2) offer you this license which gives you legal permission to copy, distribute and/or modify the library. Also, for each distributor's protection, we want to make certain that everyone understands that there is no warranty for this free library. If the library is modified by someone else and passed on, we want its recipients to know that what they have is not the original version, so that any problems introduced by others will not reflect on the original authors' reputations. Finally, any free program is threatened constantly by software patents. We wish to avoid the danger that companies distributing free software will individually obtain patent licenses, thus in effect transforming the program into proprietary software. To prevent this, we have made it clear that any patent must be licensed for everyone's free use or not licensed at all. Most GNU software, including some libraries, is covered by the ordinary GNU General Public License, which was designed for utility programs. This license, the GNU Library General Public License, applies to certain designated libraries. This license is quite different from the ordinary one; be sure to read it in full, and don't assume that anything in it is the same as in the ordinary license. The reason we have a separate public license for some libraries is that they blur the distinction we usually make between modifying or adding to a program and simply using it. Linking a program with a library, without changing the library, is in some sense simply using the library, and is analogous to running a utility program or application program. However, in a textual and legal sense, the linked executable is a combined work, a derivative of the original library, and the ordinary General Public License treats it as such. Because of this blurred distinction, using the ordinary General Public License for libraries did not effectively promote software sharing, because most developers did not use the libraries. We concluded that weaker conditions might promote sharing better. However, unrestricted linking of non-free programs would deprive the users of those programs of all benefit from the free status of the libraries themselves. This Library General Public License is intended to permit developers of non-free programs to use free libraries, while preserving your freedom as a user of such programs to change the free libraries that are incorporated in them. (We have not seen how to achieve this as regards changes in header files, but we have achieved it as regards changes in the actual functions of the Library.) The hope is that this will lead to faster development of free libraries. The precise terms and conditions for copying, distribution and modification follow. Pay close attention to the difference between a "work based on the library" and a "work that uses the library". The former contains code derived from the library, while the latter only works together with the library. Note that it is possible for a library to be covered by the ordinary General Public License rather than by this special one. GNU LIBRARY GENERAL PUBLIC LICENSE TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 0. This License Agreement applies to any software library which contains a notice placed by the copyright holder or other authorized party saying it may be distributed under the terms of this Library General Public License (also called "this License"). Each licensee is addressed as "you". A "library" means a collection of software functions and/or data prepared so as to be conveniently linked with application programs (which use some of those functions and data) to form executables. The "Library", below, refers to any such software library or work which has been distributed under these terms. A "work based on the Library" means either the Library or any derivative work under copyright law: that is to say, a work containing the Library or a portion of it, either verbatim or with modifications and/or translated straightforwardly into another language. (Hereinafter, translation is included without limitation in the term "modification".) "Source code" for a work means the preferred form of the work for making modifications to it. For a library, complete source code means all the source code for all modules it contains, plus any associated interface definition files, plus the scripts used to control compilation and installation of the library. Activities other than copying, distribution and modification are not covered by this License; they are outside its scope. The act of running a program using the Library is not restricted, and output from such a program is covered only if its contents constitute a work based on the Library (independent of the use of the Library in a tool for writing it). Whether that is true depends on what the Library does and what the program that uses the Library does. 1. You may copy and distribute verbatim copies of the Library's complete source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this License and to the absence of any warranty; and distribute a copy of this License along with the Library. You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee. 2. You may modify your copy or copies of the Library or any portion of it, thus forming a work based on the Library, and copy and distribute such modifications or work under the terms of Section 1 above, provided that you also meet all of these conditions: a) The modified work must itself be a software library. b) You must cause the files modified to carry prominent notices stating that you changed the files and the date of any change. c) You must cause the whole of the work to be licensed at no charge to all third parties under the terms of this License. d) If a facility in the modified Library refers to a function or a table of data to be supplied by an application program that uses the facility, other than as an argument passed when the facility is invoked, then you must make a good faith effort to ensure that, in the event an application does not supply such function or table, the facility still operates, and performs whatever part of its purpose remains meaningful. (For example, a function in a library to compute square roots has a purpose that is entirely well-defined independent of the application. Therefore, Subsection 2d requires that any application-supplied function or table used by this function must be optional: if the application does not supply it, the square root function must still compute square roots.) These requirements apply to the modified work as a whole. If identifiable sections of that work are not derived from the Library, and can be reasonably considered independent and separate works in themselves, then this License, and its terms, do not apply to those sections when you distribute them as separate works. But when you distribute the same sections as part of a whole which is a work based on the Library, the distribution of the whole must be on the terms of this License, whose permissions for other licensees extend to the entire whole, and thus to each and every part regardless of who wrote it. Thus, it is not the intent of this section to claim rights or contest your rights to work written entirely by you; rather, the intent is to exercise the right to control the distribution of derivative or collective works based on the Library. In addition, mere aggregation of another work not based on the Library with the Library (or with a work based on the Library) on a volume of a storage or distribution medium does not bring the other work under the scope of this License. 3. You may opt to apply the terms of the ordinary GNU General Public License instead of this License to a given copy of the Library. To do this, you must alter all the notices that refer to this License, so that they refer to the ordinary GNU General Public License, version 2, instead of to this License. (If a newer version than version 2 of the ordinary GNU General Public License has appeared, then you can specify that version instead if you wish.) Do not make any other change in these notices. Once this change is made in a given copy, it is irreversible for that copy, so the ordinary GNU General Public License applies to all subsequent copies and derivative works made from that copy. This option is useful when you wish to copy part of the code of the Library into a program that is not a library. 4. You may copy and distribute the Library (or a portion or derivative of it, under Section 2) in object code or executable form under the terms of Sections 1 and 2 above provided that you accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange. If distribution of object code is made by offering access to copy from a designated place, then offering equivalent access to copy the source code from the same place satisfies the requirement to distribute the source code, even though third parties are not compelled to copy the source along with the object code. 5. A program that contains no derivative of any portion of the Library, but is designed to work with the Library by being compiled or linked with it, is called a "work that uses the Library". Such a work, in isolation, is not a derivative work of the Library, and therefore falls outside the scope of this License. However, linking a "work that uses the Library" with the Library creates an executable that is a derivative of the Library (because it contains portions of the Library), rather than a "work that uses the library". The executable is therefore covered by this License. Section 6 states terms for distribution of such executables. When a "work that uses the Library" uses material from a header file that is part of the Library, the object code for the work may be a derivative work of the Library even though the source code is not. Whether this is true is especially significant if the work can be linked without the Library, or if the work is itself a library. The threshold for this to be true is not precisely defined by law. If such an object file uses only numerical parameters, data structure layouts and accessors, and small macros and small inline functions (ten lines or less in length), then the use of the object file is unrestricted, regardless of whether it is legally a derivative work. (Executables containing this object code plus portions of the Library will still fall under Section 6.) Otherwise, if the work is a derivative of the Library, you may distribute the object code for the work under the terms of Section 6. Any executables containing that work also fall under Section 6, whether or not they are linked directly with the Library itself. 6. As an exception to the Sections above, you may also compile or link a "work that uses the Library" with the Library to produce a work containing portions of the Library, and distribute that work under terms of your choice, provided that the terms permit modification of the work for the customer's own use and reverse engineering for debugging such modifications. You must give prominent notice with each copy of the work that the Library is used in it and that the Library and its use are covered by this License. You must supply a copy of this License. If the work during execution displays copyright notices, you must include the copyright notice for the Library among them, as well as a reference directing the user to the copy of this License. Also, you must do one of these things: a) Accompany the work with the complete corresponding machine-readable source code for the Library including whatever changes were used in the work (which must be distributed under Sections 1 and 2 above); and, if the work is an executable linked with the Library, with the complete machine-readable "work that uses the Library", as object code and/or source code, so that the user can modify the Library and then relink to produce a modified executable containing the modified Library. (It is understood that the user who changes the contents of definitions files in the Library will not necessarily be able to recompile the application to use the modified definitions.) b) Accompany the work with a written offer, valid for at least three years, to give the same user the materials specified in Subsection 6a, above, for a charge no more than the cost of performing this distribution. c) If distribution of the work is made by offering access to copy from a designated place, offer equivalent access to copy the above specified materials from the same place. d) Verify that the user has already received a copy of these materials or that you have already sent this user a copy. For an executable, the required form of the "work that uses the Library" must include any data and utility programs needed for reproducing the executable from it. However, as a special exception, the source code distributed need not include anything that is normally distributed (in either source or binary form) with the major components (compiler, kernel, and so on) of the operating system on which the executable runs, unless that component itself accompanies the executable. It may happen that this requirement contradicts the license restrictions of other proprietary libraries that do not normally accompany the operating system. Such a contradiction means you cannot use both them and the Library together in an executable that you distribute. 7. You may place library facilities that are a work based on the Library side-by-side in a single library together with other library facilities not covered by this License, and distribute such a combined library, provided that the separate distribution of the work based on the Library and of the other library facilities is otherwise permitted, and provided that you do these two things: a) Accompany the combined library with a copy of the same work based on the Library, uncombined with any other library facilities. This must be distributed under the terms of the Sections above. b) Give prominent notice with the combined library of the fact that part of it is a work based on the Library, and explaining where to find the accompanying uncombined form of the same work. 8. You may not copy, modify, sublicense, link with, or distribute the Library except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense, link with, or distribute the Library is void, and will automatically terminate your rights under this License. However, parties who have received copies, or rights, from you under this License will not have their licenses terminated so long as such parties remain in full compliance. 9. You are not required to accept this License, since you have not signed it. However, nothing else grants you permission to modify or distribute the Library or its derivative works. These actions are prohibited by law if you do not accept this License. Therefore, by modifying or distributing the Library (or any work based on the Library), you indicate your acceptance of this License to do so, and all its terms and conditions for copying, distributing or modifying the Library or works based on it. 10. Each time you redistribute the Library (or any work based on the Library), the recipient automatically receives a license from the original licensor to copy, distribute, link with or modify the Library subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. You are not responsible for enforcing compliance by third parties to this License. 11. If, as a consequence of a court judgment or allegation of patent infringement or for any other reason (not limited to patent issues), conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot distribute so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not distribute the Library at all. For example, if a patent license would not permit royalty-free redistribution of the Library by all those who receive copies directly or indirectly through you, then the only way you could satisfy both it and this License would be to refrain entirely from distribution of the Library. If any portion of this section is held invalid or unenforceable under any particular circumstance, the balance of the section is intended to apply, and the section as a whole is intended to apply in other circumstances. It is not the purpose of this section to induce you to infringe any patents or other property right claims or to contest validity of any such claims; this section has the sole purpose of protecting the integrity of the free software distribution system which is implemented by public license practices. Many people have made generous contributions to the wide range of software distributed through that system in reliance on consistent application of that system; it is up to the author/donor to decide if he or she is willing to distribute software through any other system and a licensee cannot impose that choice. This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License. 12. If the distribution and/or use of the Library is restricted in certain countries either by patents or by copyrighted interfaces, the original copyright holder who places the Library under this License may add an explicit geographical distribution limitation excluding those countries, so that distribution is permitted only in or among countries not thus excluded. In such case, this License incorporates the limitation as if written in the body of this License. 13. The Free Software Foundation may publish revised and/or new versions of the Library General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Library specifies a version number of this License which applies to it and "any later version", you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Library does not specify a license version number, you may choose any version ever published by the Free Software Foundation. 14. If you wish to incorporate parts of the Library into other free programs whose distribution conditions are incompatible with these, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally. NO WARRANTY 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. END OF TERMS AND CONDITIONS How to Apply These Terms to Your New Libraries If you develop a new library, and you want it to be of the greatest possible use to the public, we recommend making it free software that everyone can redistribute and change. You can do so by permitting redistribution under these terms (or, alternatively, under the terms of the ordinary General Public License). To apply these terms, attach the following notices to the library. It is safest to attach them to the start of each source file to most effectively convey the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. Copyright (C) This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. 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. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; if not, write to the Free Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Also add information on how to contact you by electronic and paper mail. You should also get your employer (if you work as a programmer) or your school, if any, to sign a "copyright disclaimer" for the library, if necessary. Here is a sample; alter the names: Yoyodyne, Inc., hereby disclaims all copyright interest in the library `Frob' (a library for tweaking knobs) written by James Random Hacker. , 1 April 1990 Ty Coon, President of Vice That's all there is to it! Math-GMP-2.06/LICENSE0000644000076400007640000000166310126260246012427 0ustar greggregMath::GMP, a Perl module for high-speed arbitrary size integer calculations Copyright (C) 2000 James H. Turner This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. 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. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; if not, write to the Free Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA You can contact the author at chip@redhat.com, chipt@cpan.org, or by mail: Chip Turner Red Hat Inc. 2600 Meridian Park Blvd Durham, NC 27713