r25941 - in /trunk/libmath-gmp-perl: ./ debian/ debian/patches/ lib/Math/ t/

ansgar-guest at users.alioth.debian.org ansgar-guest at users.alioth.debian.org
Sat Oct 11 13:43:42 UTC 2008


Author: ansgar-guest
Date: Sat Oct 11 13:43:32 2008
New Revision: 25941

URL: http://svn.debian.org/wsvn/pkg-perl/?sc=1&rev=25941
Log:
* New upstream release.
* Remove patch framework (patch was applied upstream)
* Refresh debian/rules for debhelper 7.
* Bump Standards Version to 3.8.0
* Enable Perl::Critic tests, do not yet enable POD tests as they still
  fail due to missing coverage
* Convert debian/copyright to proposed machine-readable format

Added:
    trunk/libmath-gmp-perl/.perlcriticrc
      - copied unchanged from r25940, branches/upstream/libmath-gmp-perl/current/.perlcriticrc
    trunk/libmath-gmp-perl/MANIFEST.SKIP
      - copied unchanged from r25940, branches/upstream/libmath-gmp-perl/current/MANIFEST.SKIP
    trunk/libmath-gmp-perl/META.yml
      - copied unchanged from r25940, branches/upstream/libmath-gmp-perl/current/META.yml
    trunk/libmath-gmp-perl/SIGNATURE
      - copied unchanged from r25940, branches/upstream/libmath-gmp-perl/current/SIGNATURE
    trunk/libmath-gmp-perl/t/00_signature.t
      - copied unchanged from r25940, branches/upstream/libmath-gmp-perl/current/t/00_signature.t
    trunk/libmath-gmp-perl/t/01_gmppm.t
      - copied unchanged from r25940, branches/upstream/libmath-gmp-perl/current/t/01_gmppm.t
    trunk/libmath-gmp-perl/t/99_perlcritic.t
      - copied unchanged from r25940, branches/upstream/libmath-gmp-perl/current/t/99_perlcritic.t
    trunk/libmath-gmp-perl/t/99_pod.t
      - copied unchanged from r25940, branches/upstream/libmath-gmp-perl/current/t/99_pod.t
    trunk/libmath-gmp-perl/t/99_spellcheck.t
      - copied unchanged from r25940, branches/upstream/libmath-gmp-perl/current/t/99_spellcheck.t
    trunk/libmath-gmp-perl/t/99_yaml.t
      - copied unchanged from r25940, branches/upstream/libmath-gmp-perl/current/t/99_yaml.t
Removed:
    trunk/libmath-gmp-perl/debian/README.source
    trunk/libmath-gmp-perl/debian/patches/
    trunk/libmath-gmp-perl/t/gmppm.t
Modified:
    trunk/libmath-gmp-perl/Changes
    trunk/libmath-gmp-perl/GMP.xs
    trunk/libmath-gmp-perl/INSTALL
    trunk/libmath-gmp-perl/MANIFEST
    trunk/libmath-gmp-perl/Makefile.PL
    trunk/libmath-gmp-perl/debian/changelog
    trunk/libmath-gmp-perl/debian/compat
    trunk/libmath-gmp-perl/debian/control
    trunk/libmath-gmp-perl/debian/copyright
    trunk/libmath-gmp-perl/debian/rules
    trunk/libmath-gmp-perl/lib/Math/GMP.pm

Modified: trunk/libmath-gmp-perl/Changes
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libmath-gmp-perl/Changes?rev=25941&op=diff
==============================================================================
--- trunk/libmath-gmp-perl/Changes (original)
+++ trunk/libmath-gmp-perl/Changes Sat Oct 11 13:43:32 2008
@@ -1,8 +1,18 @@
 Revision history for Perl extension Math::GMP.
+
+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 at 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 at oxhoej.dk)
+	  with different bases (nicholas at oxhoej.dk) (CPAN bug #4472)
 
 2.03  2002-02-16 Tels
 	- added internal functions gmp_copy, gmp_tstbit, gmp_sqrt

Modified: trunk/libmath-gmp-perl/GMP.xs
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libmath-gmp-perl/GMP.xs?rev=25941&op=diff
==============================================================================
--- trunk/libmath-gmp-perl/GMP.xs (original)
+++ trunk/libmath-gmp-perl/GMP.xs Sat Oct 11 13:43:32 2008
@@ -347,6 +347,16 @@
   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

Modified: trunk/libmath-gmp-perl/INSTALL
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libmath-gmp-perl/INSTALL?rev=25941&op=diff
==============================================================================
--- trunk/libmath-gmp-perl/INSTALL (original)
+++ trunk/libmath-gmp-perl/INSTALL Sat Oct 11 13:43:32 2008
@@ -17,3 +17,36 @@
 
 Enjoy!
 
+If you have problems, please check the platform-specific notes below.
+
+
+** Notes for AIX **
+
+tswd13 at 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 </usr/local/include/gmp.h>
+
+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
+

Modified: trunk/libmath-gmp-perl/MANIFEST
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libmath-gmp-perl/MANIFEST?rev=25941&op=diff
==============================================================================
--- trunk/libmath-gmp-perl/MANIFEST (original)
+++ trunk/libmath-gmp-perl/MANIFEST Sat Oct 11 13:43:32 2008
@@ -6,6 +6,15 @@
 lib/Math/GMP.pm
 GMP.xs
 MANIFEST
+MANIFEST.SKIP
+SIGNATURE
+META.yml
 Makefile.PL
 typemap
-t/gmppm.t
+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

Modified: trunk/libmath-gmp-perl/Makefile.PL
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libmath-gmp-perl/Makefile.PL?rev=25941&op=diff
==============================================================================
--- trunk/libmath-gmp-perl/Makefile.PL (original)
+++ trunk/libmath-gmp-perl/Makefile.PL Sat Oct 11 13:43:32 2008
@@ -1,10 +1,39 @@
+#!perl
+
+use strict;
+use warnings;
 use ExtUtils::MakeMaker;
-# See lib/ExtUtils/MakeMaker.pm for details of how to influence
-# the contents of the Makefile that is written.
 
-WriteMakefile(
-    'NAME'	=> 'Math::GMP',
-    'VERSION_FROM' => 'lib/Math/GMP.pm', # finds $VERSION
-    'LIBS'	=> ['-lgmp'],   # e.g., '-lm' 
-    'DEFINE'	=> '',     # e.g., '-DHAVE_SOMETHING' 
-);
+my $output = WriteMakefile
+	(
+	 'NAME'	        => 'Math::GMP',
+	 'VERSION_FROM' => 'lib/Math/GMP.pm',
+	 'LIBS'	        => ['-lgmp'],
+	 'NO_META'      => 1,
+	 );
+
+if (!exists $output->{EXTRALIBS} or $output->{EXTRALIBS} !~ /lgmp/) {
+
+	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
+	unlink $output->{MAKEFILE} if $makefile;
+
+	exit 1;
+}
+
+exit 0;
+
+# end of Makefile.PL

Modified: trunk/libmath-gmp-perl/debian/changelog
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libmath-gmp-perl/debian/changelog?rev=25941&op=diff
==============================================================================
--- trunk/libmath-gmp-perl/debian/changelog (original)
+++ trunk/libmath-gmp-perl/debian/changelog Sat Oct 11 13:43:32 2008
@@ -1,5 +1,6 @@
-libmath-gmp-perl (2.04-3) UNRELEASED; urgency=low
+libmath-gmp-perl (2.05-1) unstable; urgency=low
 
+  [ gregor herrmann ]
   * Take over for the Debian Perl Group with maintainer's permission
     (http://lists.debian.org/debian-perl/2008/06/msg00039.html)
   * debian/control: Added: Vcs-Svn field (source stanza); Vcs-Browser
@@ -9,11 +10,17 @@
     <rafl at debian.org>); Florian Ragwitz <rafl at debian.org> moved to
     Uploaders.
   * Add debian/watch.
-  * Switch patch system from dpatch to quilt.
-  * Add debian/README.source to document quilt usage, as required by
-    Debian Policy since 3.8.0.
 
- -- gregor herrmann <gregoa at debian.org>  Sun, 15 Jun 2008 18:48:44 +0200
+  [ Ansgar Burchardt ]
+  * New upstream release.
+  * Remove patch framework (patch was applied upstream)
+  * Refresh debian/rules for debhelper 7.
+  * Bump Standards Version to 3.8.0
+  * Enable Perl::Critic tests, do not yet enable POD tests as they still
+    fail due to missing coverage
+  * Convert debian/copyright to proposed machine-readable format
+
+ -- Ansgar Burchardt <ansgar at 43-1.org>  Sat, 11 Oct 2008 15:40:26 +0200
 
 libmath-gmp-perl (2.04-2.1) unstable; urgency=low
 

Modified: trunk/libmath-gmp-perl/debian/compat
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libmath-gmp-perl/debian/compat?rev=25941&op=diff
==============================================================================
--- trunk/libmath-gmp-perl/debian/compat (original)
+++ trunk/libmath-gmp-perl/debian/compat Sat Oct 11 13:43:32 2008
@@ -1,1 +1,1 @@
-5
+7

Modified: trunk/libmath-gmp-perl/debian/control
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libmath-gmp-perl/debian/control?rev=25941&op=diff
==============================================================================
--- trunk/libmath-gmp-perl/debian/control (original)
+++ trunk/libmath-gmp-perl/debian/control Sat Oct 11 13:43:32 2008
@@ -1,10 +1,12 @@
 Source: libmath-gmp-perl
 Section: perl
 Priority: optional
-Build-Depends: debhelper (>= 5.0.0), quilt (>= 0.40), perl (>= 5.8.0-7), libgmp3-dev
+Build-Depends: debhelper (>= 7), perl (>= 5.8.0-7), libgmp3-dev,
+ libtest-yaml-meta-perl, libperl-critic-perl (>= 0.23)
 Maintainer: Debian Perl Group <pkg-perl-maintainers at lists.alioth.debian.org>
-Uploaders: Florian Ragwitz <rafl at debian.org>
-Standards-Version: 3.6.2
+Uploaders: Florian Ragwitz <rafl at debian.org>,
+ Ansgar Burchardt <ansgar at 43-1.org>
+Standards-Version: 3.8.0
 Homepage: http://search.cpan.org/dist/Math-GMP/
 Vcs-Svn: svn://svn.debian.org/pkg-perl/trunk/libmath-gmp-perl/
 Vcs-Browser: http://svn.debian.org/wsvn/pkg-perl/trunk/libmath-gmp-perl/

Modified: trunk/libmath-gmp-perl/debian/copyright
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libmath-gmp-perl/debian/copyright?rev=25941&op=diff
==============================================================================
--- trunk/libmath-gmp-perl/debian/copyright (original)
+++ trunk/libmath-gmp-perl/debian/copyright Sat Oct 11 13:43:32 2008
@@ -1,20 +1,25 @@
-This package was debianized by Florian Ragwitz <rafl at debian.org> on
-Wed, 02 Nov 2005 18:52:43 +0100.
+Format-Specification: http://wiki.debian.org/Proposals/CopyrightFormat?action=recall&rev=228
+Upstream-Name: Math-GMP
+Upstream-Maintainer: Greg Sabino Mullane <greg at turnstep.com>
+Upstream-Source: http://search.cpan.org/dist/Math-GMP/
 
-It was downloaded from http://search.cpan.org/~chipt/Math-GMP/
+Files: *
+Copyright:
+ © 2000-2008, James H. Turner
+ © 2008,      Greg Sabino Mullane <greg at turnstep.com>
+License: GPL-2+
+ 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.
 
-Copyright (C) 2000-2004 James H. Turner.
+Files: debian/*
+Copyright:
+ © 2005-2006, Florian Ragwitz <rafl at debian.org>
+ © 2008,      Niko Tyni <ntyni at debian.org>
+ © 2008,      gregor herrmann <gregoa at debian.org>
+ © 2008,      Ansgar Burchardt <ansgar at 43-1.org>
+License: GPL-2+
+ It is assumed that all contributors put their work under the same license
+ as the module itself.
 
-Based on the old Math::BigInt:
-
-  Original code by Mark Biggar, overloaded interface by Ilya Zakharevich.
-  Completely rewritten by Tels http://bloodgate.com in late 2000, 2001 - 2004
-  and still at it in 2005.
-
-This program is free software, you can redistribute it and/or modify it under
-the same terms as Perl itself.
-
-Perl is distributed under your choice of the GNU General Public License or
-the Artistic License.  On Debian GNU/Linux systems, the complete text of the
-GNU General Public License can be found in `/usr/share/common-licenses/GPL'
-and the Artistic Licence in `/usr/share/common-licenses/Artistic'.

Modified: trunk/libmath-gmp-perl/debian/rules
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libmath-gmp-perl/debian/rules?rev=25941&op=diff
==============================================================================
--- trunk/libmath-gmp-perl/debian/rules (original)
+++ trunk/libmath-gmp-perl/debian/rules Sat Oct 11 13:43:32 2008
@@ -1,78 +1,23 @@
 #!/usr/bin/make -f
 
-export PERL_MM_USE_DEFAULT=1
+build: build-stamp
+build-stamp:
+	TEST_CRITIC=1 dh build
+	touch $@
 
-PACKAGE=$(shell dh_listpackages)
+clean:
+	dh $@
 
-ifndef PERL
-PERL = /usr/bin/perl
-endif
+install: install-stamp
+install-stamp: build-stamp
+	dh install
+	touch $@
 
-TMP     =$(CURDIR)/debian/$(PACKAGE)
+binary-arch: install
+	dh $@
 
-CFLAGS = -Wall -g
-ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS)))
-        CFLAGS += -O0
-else
-        CFLAGS += -O2
-endif
+binary-indep:
 
-build: build-stamp
-build-stamp: patch
-	dh_testdir
-	$(PERL) Makefile.PL INSTALLDIRS=vendor
-	$(MAKE) OPTIMIZE="$(CFLAGS)" LD_RUN_PATH=""
-	touch build-stamp
+binary: binary-arch binary-indep
 
-clean: clean1 unpatch
-clean1:
-	dh_testdir
-	dh_testroot
-	[ ! -f Makefile ] || $(MAKE) realclean
-	dh_clean build-stamp install-stamp
-
-install: build install-stamp
-install-stamp:
-	dh_testdir
-	dh_testroot
-	dh_clean -k
-	$(MAKE) test
-	$(MAKE) install DESTDIR=$(TMP) PREFIX=/usr
-	[ ! -d $(TMP)/usr/share/perl5 ] || rmdir --ignore-fail-on-non-empty --parents $(TMP)/usr/share/perl5
-	touch install-stamp
-
-patch: $(QUILT_STAMPFN)
-$(QUILT_STAMPFN):
-	dpatch apply-all
-	touch $(QUILT_STAMPFN)
-
-unpatch:
-	dpatch deapply-all
-	rm -rf $(QUILT_STAMPFN) debian/patched
-
-# Build architecture-independent files here.
-binary-indep: build install
-# We have nothing to do by default.
-
-# Build architecture-dependent files here.
-binary-arch: build install
-	dh_testdir
-	dh_testroot
-	dh_installdocs README
-	dh_installexamples 
-	dh_installchangelogs Changes
-	dh_strip
-	dh_compress
-	dh_fixperms
-	dh_installdeb
-	dh_perl 
-	dh_shlibdeps
-	dh_gencontrol
-	dh_md5sums
-	dh_builddeb
-
-source diff:                                                                  
-	@echo >&2 'source and diff are obsolete - use dpkg-source -b'; false
-
-binary: binary-indep binary-arch
-.PHONY: build clean binary-indep binary-arch binary patch unpatch clean1
+.PHONY: binary binary-arch binary-indep install clean build

Modified: trunk/libmath-gmp-perl/lib/Math/GMP.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libmath-gmp-perl/lib/Math/GMP.pm?rev=25941&op=diff
==============================================================================
--- trunk/libmath-gmp-perl/lib/Math/GMP.pm (original)
+++ trunk/libmath-gmp-perl/lib/Math/GMP.pm Sat Oct 11 13:43:32 2008
@@ -2,7 +2,8 @@
 
 # Math::GMP, a Perl module for high-speed arbitrary size integer
 # calculations
-# Copyright (C) 2000 James H. Turner
+# Copyright (C) 2000-2008 James H. Turner
+# Copyright (C) 2008 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
@@ -25,27 +26,30 @@
 # 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;
+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;
@@ -55,200 +59,203 @@
 # 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.
- at EXPORT = qw(
-	
-);
-$VERSION = '2.04';
+
+our $VERSION = '2.05';
 
 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;
+	# 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";
+		}
 	}
-	else {
-		croak "Your vendor has not defined Math::GMP macro $constname";
-	}
-    }
-    no strict 'refs';
-    *$AUTOLOAD = sub () { $val };
-    goto &$AUTOLOAD;
+	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) };
-}
-  
+	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;
+	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;
-}
+	{
+		*DESTROY = \&Math::GMP::destroy;
+	}
 
 sub add {
-  croak "add: not enough arguments, two required" unless @_ > 1;
-
-  my $ret = Math::GMP->new(0);
-  add_to_self($ret, shift) while @_;
-
-  return $ret;
+	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]);
+	return Math::GMP::stringify_gmp($_[0]);
 }
 
 sub intify {
-  return Math::GMP::intify_gmp($_[0]);
+	return Math::GMP::intify_gmp($_[0]);
 }
 
 sub promote {
-  return $_[0] if ref $_[0] eq 'Math::GMP';
-  return Math::GMP::new_from_scalar($_[0] || 0);
+	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));
+	return gcd_two(promote(shift), promote(shift));
 }
 
 sub bgcd {
-  return gcd_two(promote(shift), promote(shift));
+	return gcd_two(promote(shift), promote(shift));
 }
 
 sub legendre {
-  return gmp_legendre(promote(shift), promote(shift));
+	return gmp_legendre(promote(shift), promote(shift));
 }
 
 sub jacobi {
-  return gmp_jacobi(promote(shift), promote(shift));
+	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));
+	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));
+	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));
+	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));
+	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));
+	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));
+	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)));
+	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;
+	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));
+	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));
+	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));
+	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));
+	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));
+	return or_two(promote(shift), promote(shift));
 }
 
 sub band {
-  return and_two(promote(shift), promote(shift));
+	return and_two(promote(shift), promote(shift));
 }
 
 sub bxor {
-  return xor_two(promote(shift), promote(shift));
+	return xor_two(promote(shift), promote(shift));
 }
 
 sub bfac {
-  return gmp_fac(int(shift));
+	return gmp_fac(int(shift));
 }
 
 sub fibonacci {
-  return gmp_fib(int(shift));
+	return gmp_fib(int(shift));
 }
 
 __END__
@@ -300,63 +307,71 @@
 
 =head2 new
 
-	$x = Math::GMP->new(123);
+  $x = Math::GMP->new(123);
 
 Creates a new Math::GMP object from the passed string or scalar.
 
-	$x = Math::GMP->new('abcd', 36);
+  $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
+  $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
+
+  $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
+
+  $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
+  $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 returnes
-the result.
+
+  $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);
+
+  $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
 
@@ -378,7 +393,7 @@
 default pure Perl implementation. You can use, for instance, Math::GMP
 with it:
 
-	use Math::BigInt lib => 'GMP';
+  use Math::BigInt lib => 'GMP';
 
 If Math::GMP is not installed, it will fall back to it's own Perl
 implementation.




More information about the Pkg-perl-cvs-commits mailing list