r13996 - in /trunk/libmath-bigint-gmp-perl: ./ debian/ lib/Math/BigInt/ t/
gregoa-guest at users.alioth.debian.org
gregoa-guest at users.alioth.debian.org
Fri Feb 1 17:49:43 UTC 2008
Author: gregoa-guest
Date: Fri Feb 1 17:49:43 2008
New Revision: 13996
URL: http://svn.debian.org/wsvn/?sc=1&rev=13996
Log:
New upstream release.
Added:
trunk/libmath-bigint-gmp-perl/MANIFEST.SKIP
- copied unchanged from r13995, branches/upstream/libmath-bigint-gmp-perl/current/MANIFEST.SKIP
trunk/libmath-bigint-gmp-perl/t/biglog.t
- copied unchanged from r13995, branches/upstream/libmath-bigint-gmp-perl/current/t/biglog.t
trunk/libmath-bigint-gmp-perl/t/bigroot.t
- copied unchanged from r13995, branches/upstream/libmath-bigint-gmp-perl/current/t/bigroot.t
trunk/libmath-bigint-gmp-perl/t/pod.t
- copied unchanged from r13995, branches/upstream/libmath-bigint-gmp-perl/current/t/pod.t
trunk/libmath-bigint-gmp-perl/t/pod_cov.t
- copied unchanged from r13995, branches/upstream/libmath-bigint-gmp-perl/current/t/pod_cov.t
Removed:
trunk/libmath-bigint-gmp-perl/NEW
Modified:
trunk/libmath-bigint-gmp-perl/CHANGES
trunk/libmath-bigint-gmp-perl/GMP.xs
trunk/libmath-bigint-gmp-perl/INSTALL
trunk/libmath-bigint-gmp-perl/MANIFEST
trunk/libmath-bigint-gmp-perl/META.yml
trunk/libmath-bigint-gmp-perl/Makefile.PL
trunk/libmath-bigint-gmp-perl/SIGNATURE
trunk/libmath-bigint-gmp-perl/TODO
trunk/libmath-bigint-gmp-perl/debian/changelog
trunk/libmath-bigint-gmp-perl/lib/Math/BigInt/GMP.pm
trunk/libmath-bigint-gmp-perl/t/bigfltpm.inc
trunk/libmath-bigint-gmp-perl/t/bigfltpm.t
trunk/libmath-bigint-gmp-perl/t/bigintg.t
trunk/libmath-bigint-gmp-perl/t/bigintpm.inc
trunk/libmath-bigint-gmp-perl/t/bigintpm.t
trunk/libmath-bigint-gmp-perl/typemap
Modified: trunk/libmath-bigint-gmp-perl/CHANGES
URL: http://svn.debian.org/wsvn/trunk/libmath-bigint-gmp-perl/CHANGES?rev=13996&op=diff
==============================================================================
--- trunk/libmath-bigint-gmp-perl/CHANGES (original)
+++ trunk/libmath-bigint-gmp-perl/CHANGES Fri Feb 1 17:49:43 2008
@@ -1,4 +1,70 @@
+2007-07-31 v1.24 Tels 5530 tests
+ * apply patch for warnings about ptr size mismatch under Cygwin (thanx Reini Urban!)
+ * make it work under 5.6.x again by defining SvUOK() (Thanx Marcus Holland-Moritz
+ and Reini Urban!)
+
+2007-07-25 v1.23 Tels 5527 tests
+ * require Math::BigInt 1.87
+ * fix for _new() (appeared under Cygwin, but possible others, thanx
+ Linda W. (report) and Reini Urban (patch)!)
+
+2007-06-01 v1.22 Tels 5527 tests
+ * require Math::BigInt 1.86
+ * support api_version() 2 by adding _nok()
+ * fix compilation issues on Mac/Darwin
+ * _log_int() modifies it's argument instead of just returning a
+ different object as result
+ * speed up _log_int() greatly by taking a guess of the result
+ and then improve it, instead of startig with 1 and going up. This means
+ it takes now a more or less constant time, instead of a time proportional
+ to the size/value of the result:
+
+ Using Math::BigInt::GMP v1.21
+ baselen 2: 3s (3.22 usr + 0.00 sys = 3.22 CPU) @ 7270/s (n=23411)
+ baselen 2 big: 3s (3.11 usr + 0.06 sys = 3.17 CPU) @ 962/s (n=3051)
+ baselen 3: 3s (3.20 usr + 0.00 sys = 3.20 CPU) @ 1304/s (n=4173)
+ baselen 7: 3s (3.20 usr + 0.00 sys = 3.20 CPU) @ 3306/s (n=10582)
+ baselen 8: 3s (3.14 usr + 0.00 sys = 3.14 CPU) @ 3769/s (n=11836)
+ baselen 11: 3s (3.24 usr + 0.00 sys = 3.24 CPU) @ 4750/s (n=15392)
+ baselen 14: 3s (3.20 usr + 0.00 sys = 3.20 CPU) @ 5835/s (n=18673)
+ baselen 20: 3s (3.10 usr + 0.03 sys = 3.13 CPU) @ 7621/s (n=23855)
+ baselen 3 big: 4s (3.17 usr + 0.00 sys = 3.17 CPU) @ 320/s (n=1016)
+
+ Using Math::BigInt::GMP v1.22
+ baselen 2: 3s (3.15 usr + 0.00 sys = 3.15 CPU) @ 16290/s (n=51316)
+ baselen 2 big: 4s (3.21 usr + 0.01 sys = 3.22 CPU) @ 15933/s (n=51306)
+ baselen 3: 4s (3.12 usr + 0.02 sys = 3.14 CPU) @ 15555/s (n=48844)
+ baselen 7: 4s (3.15 usr + 0.07 sys = 3.22 CPU) @ 15658/s (n=50420)
+ baselen 8: 3s (3.18 usr + 0.01 sys = 3.19 CPU) @ 15610/s (n=49797)
+ baselen 11: 3s (3.14 usr + 0.00 sys = 3.14 CPU) @ 15555/s (n=48844)
+ baselen 14: 3s (3.15 usr + 0.00 sys = 3.15 CPU) @ 15506/s (n=48844)
+ baselen 20: 3s (3.14 usr + 0.01 sys = 3.15 CPU) @ 15506/s (n=48844)
+ baselen 3 big: 3s (3.10 usr + 0.04 sys = 3.14 CPU) @ 15555/s (n=48844)
+
+2007-04-17 v1.21 Tels 5488 tests
+ * add _as_oct(), _from_oct(), _alen(), _1ex() and some _root() tests
+ * require Math::BigInt 1.83
+ * support api_version() by adding _1ex() and _alen()
+ * _new(): take a shortcut if the passed an IV (integer value)
+
+2007-04-09 v1.20 Tels 5351 tests
+ * remove PREREQ_FATAL because the toolchain is broken and cannot handle it
+ * take over tests from MBI 1.82 and require it
+ * require Perl 5.6.2 as minimum
+ * speed up _zeros():
+ + use Newx() instead of a full-blown SV for temp storage
+ + no need to allocate temp storage for numbers < 10
+ * put _len() into XS code, making $x->length() faster (about 30% for "123",
+ less for longer numbers as the binary=>decimal conversion dominates)
+ * add POD tests
+ * add MANIFEST.SKIP
+
+2007-01-27 v1.19 Tels 5339 tests
+ * add support for octal
+ * take over tests from MBI 1.78 and require it
+
+Older Changelog:
2001-07-22 v1.00 Tels
* First version (basically working with some quirks)
Modified: trunk/libmath-bigint-gmp-perl/GMP.xs
URL: http://svn.debian.org/wsvn/trunk/libmath-bigint-gmp-perl/GMP.xs?rev=13996&op=diff
==============================================================================
--- trunk/libmath-bigint-gmp-perl/GMP.xs (original)
+++ trunk/libmath-bigint-gmp-perl/GMP.xs Fri Feb 1 17:49:43 2008
@@ -3,8 +3,13 @@
#include "XSUB.h"
#include "gmp.h"
+/* for Perl prior to v5.7.1 */
+#ifndef SvUOK
+# define SvUOK(sv) SvIOK_UV(sv)
+#endif
+
/*
-Math::BigInt::GMP XS code, largely based on Math::GMP, a Perl module for
+Math::BigInt::GMP XS code, loosely based on Math::GMP, a Perl module for
high-speed arbitrary size integer calculations (C) 2000 James H. Turner
*/
@@ -15,11 +20,11 @@
#define NEW_GMP_MPZ_T_INIT RETVAL = malloc (sizeof(mpz_t)); mpz_init(*RETVAL);
#define GMP_GET_ARG_0 if (sv_derived_from(x, "Math::BigInt::GMP")) {\
IV tmp = SvIV((SV*)SvRV(x));\
- TEMP = (mpz_t*) tmp;\
+ TEMP = INT2PTR(mpz_t*, tmp);\
} else { croak("x is not of type Math::BigInt::GMP"); }
#define GMP_GET_ARG_1 if (sv_derived_from(y, "Math::BigInt::GMP")) {\
IV tmp = SvIV((SV*)SvRV(y));\
- TEMP_1 = (mpz_t*) tmp;\
+ TEMP_1 = INT2PTR(mpz_t*, tmp);\
} else { croak("y is not of type Math::BigInt::GMP"); }
#define GMP_GET_ARGS_0_1 GMP_GET_ARG_0; GMP_GET_ARG_1;
@@ -32,15 +37,36 @@
CODE:
NEW_GMP_MPZ_T;
+ /* using the IV directly is a bit faster */
+ if (SvUOK(x))
+ {
+ mpz_init_set_si(*RETVAL, (UV)SvUV(x));
+ }
+ else
+ {
+ mpz_init_set_str(*RETVAL, SvPV_nolen(x), 10);
+ }
+ OUTPUT:
+ RETVAL
+
+##############################################################################
+# _from_bin()
+
+mpz_t *
+_from_bin(Class,x)
+ SV* x
+
+ CODE:
+ NEW_GMP_MPZ_T;
mpz_init_set_str(*RETVAL, SvPV_nolen(x), 0);
OUTPUT:
RETVAL
##############################################################################
-# _from_bin()
-
-mpz_t *
-_from_bin(Class,x)
+# _from_hex()
+
+mpz_t *
+_from_hex(Class,x)
SV* x
CODE:
@@ -50,10 +76,10 @@
RETVAL
##############################################################################
-# _from_hex()
-
-mpz_t *
-_from_hex(Class,x)
+# _from_oct()
+
+mpz_t *
+_from_oct(Class,x)
SV* x
CODE:
@@ -63,6 +89,17 @@
RETVAL
##############################################################################
+# _set() - set an already existing object to the given scalar value
+
+void
+_set(Class,n,x)
+ mpz_t* n
+ SV* x
+
+ CODE:
+ mpz_init_set_ui(*n, SvIV(x));
+
+##############################################################################
# _zero()
mpz_t *
@@ -110,6 +147,19 @@
OUTPUT:
RETVAL
+##############################################################################
+# _1ex()
+
+mpz_t *
+_1ex(Class,x)
+ int x;
+
+ CODE:
+ NEW_GMP_MPZ_T;
+ mpz_init_set_ui(*RETVAL, 10);
+ mpz_pow_ui(*RETVAL, *RETVAL, x);
+ OUTPUT:
+ RETVAL
##############################################################################
# DESTROY() - free memory of a GMP number
@@ -150,6 +200,46 @@
RETVAL
##############################################################################
+# _len() - return the length of the number in base 10 (costly)
+
+int
+_len(Class, n)
+ mpz_t* n
+ PREINIT:
+ char *buf;
+ char *buf_end;
+
+ CODE:
+ /* len is always >= 1, and might be off (greater) by one than real len */
+ RETVAL = mpz_sizeinbase(*n, 10);
+ if (RETVAL > 1) /* is at least 10? */
+ {
+ New(0, buf, RETVAL + 1, I8); /* alloc scratch buffer (len+1) bytes */
+ buf_end = buf + RETVAL - 1; /* end of storage (-1)*/
+ mpz_get_str(buf, 10, *n); /* convert to decimal string */
+ if (*buf_end == 0)
+ {
+ RETVAL --; /* got one shorter than expected */
+ }
+ Safefree(buf); /* free the scratch buffer */
+ }
+ OUTPUT:
+ RETVAL
+
+##############################################################################
+# _alen() - return the approx. length of the number in base 10 (fast)
+
+int
+_alen(Class, n)
+ mpz_t* n
+
+ CODE:
+ /* len is always >= 1, and might be off (greater) by one than real len */
+ RETVAL = mpz_sizeinbase(*n, 10);
+ OUTPUT:
+ RETVAL
+
+##############################################################################
# _zeros() - return number of trailing zeros (in decimal form)
# This is costly, since it needs O(N*N) to convert the number to decimal,
# even though for most cases the number does not have many trailing zeros.
@@ -161,7 +251,6 @@
mpz_t* n
PREINIT:
- SV* TEMP;
int len;
char *buf;
char *buf_end;
@@ -173,31 +262,29 @@
if (RETVAL != 0) /* was even */
{
/* len is always >= 1, and might be off (greater) by one than real len */
+ RETVAL = 0;
len = mpz_sizeinbase(*n, 10);
- TEMP = newSV(len); /* alloc len +1 bytes */
- SvPOK_on(TEMP); /* make an PV */
- buf = SvPVX(TEMP); /* get ptr to storage */
- buf_end = buf + len - 1; /* end of storage (-1)*/
- mpz_get_str(buf, 10, *n); /* convert to decimal string */
- RETVAL = 0;
- if (*buf_end == 0) /* points to terminating zero? */
- {
- buf_end--; /* ptr to last real digit */
- len --; /* got one shorter than expected */
- }
- if (len > 1) /* '0' has not trailing zeross! */
- {
- while (len-- > 0) /* actually, we should hit a nonzero */
- { /* before the end */
- if (*buf_end-- != '0')
+ if (len > 1) /* '0' has no trailing zeros! */
+ {
+ New(0, buf, len + 1, I8);
+ mpz_get_str(buf, 10, *n); /* convert to decimal string */
+ buf_end = buf + len - 1;
+ if (*buf_end == 0) /* points to terminating zero? */
+ {
+ buf_end--; /* ptr to last real digit */
+ len--; /* got one shorter than expected */
+ }
+ while (len-- > 0) /* actually, we should hit a non-zero before the end */
+ {
+ if (*buf_end-- != '0')
{
break;
}
RETVAL++;
- }
- }
- SvREFCNT_dec(TEMP); /* Bumpersticker: Free Temp! */
- } /* end if n was even */
+ }
+ Safefree(buf); /* free the scratch buffer */
+ }
+ } /* end if n was even */
OUTPUT:
RETVAL
@@ -247,6 +334,28 @@
OUTPUT:
RETVAL
+##############################################################################
+# _as_oct() - return ref to octal string (prefixed with 0)
+
+SV *
+_as_oct(Class,n)
+ mpz_t * n
+
+ PREINIT:
+ int len;
+ char *buf;
+
+ CODE:
+ /* len is always >= 1, and accurate (unlike in decimal) */
+ len = mpz_sizeinbase(*n, 8) + 1;
+ RETVAL = newSV(len); /* alloc len +1 (+1 for '0') bytes */
+ SvPOK_on(RETVAL);
+ buf = SvPVX(RETVAL); /* get ptr to storage */
+ *buf++ = '0'; /* prepend '0' */
+ mpz_get_str(buf, 8, *n); /* convert to binary string */
+ SvCUR_set(RETVAL, len); /* so set real length */
+ OUTPUT:
+ RETVAL
##############################################################################
# _modpow() - ($n ** $exp) % $mod
Modified: trunk/libmath-bigint-gmp-perl/INSTALL
URL: http://svn.debian.org/wsvn/trunk/libmath-bigint-gmp-perl/INSTALL?rev=13996&op=diff
==============================================================================
--- trunk/libmath-bigint-gmp-perl/INSTALL (original)
+++ trunk/libmath-bigint-gmp-perl/INSTALL Fri Feb 1 17:49:43 2008
@@ -1,6 +1,4 @@
Module to replace Math::BigInt's core math routines by using Math::GMP.
-
-(C) ..--- ----- ----- .---- by - . .-.. ... .-.-.- All rights reserved.
This package contains a replacement (drop-in) module for Math::BigInt's core,
Math::BigInt::Calc.pm. It needs the new versions of Math::BigInt and
@@ -8,12 +6,27 @@
You need to install the Gnu MP library aka libgmp to compile this module.
+INSTALL
+=======
+
How to install:
perl Makefile.PL
make
make test
make install
+
+If you have trouble compiling this package because the GMP library is
+installed in a non-standard location, try to pass the INC and LIBS
+arguments to Makefile.PL with the appropriate information. Here
+is an example:
+
+ perl Makefile.PL\
+ INC="-I/apps/perl588/site/gmp-4.2.1/include"\
+ LIBS="-L/apps/perl588/site/gmp-4.2.1/lib -lgmp"
+
+USAGE
+=====
To use it, replace:
Modified: trunk/libmath-bigint-gmp-perl/MANIFEST
URL: http://svn.debian.org/wsvn/trunk/libmath-bigint-gmp-perl/MANIFEST?rev=13996&op=diff
==============================================================================
--- trunk/libmath-bigint-gmp-perl/MANIFEST (original)
+++ trunk/libmath-bigint-gmp-perl/MANIFEST Fri Feb 1 17:49:43 2008
@@ -1,23 +1,27 @@
+BUGS
+build/leak.pl
+build/leaktest
+build/README
CHANGES
CREDITS
-BUGS
+GMP.xs
INSTALL
+lib/Math/BigInt/GMP.pm
+LICENSE
+Makefile.PL
+MANIFEST
+MANIFEST.SKIP
+META.yml Module meta-data (added by MakeMaker)
README
-LICENSE
-MANIFEST
-NEW
SIGNATURE
+t/bigfltpm.inc # actual tests
+t/bigfltpm.t # original test, but with Math::GMP
+t/bigintg.t # Math::GMP implementation of uint math core
+t/bigintpm.inc # actual tests
+t/bigintpm.t # original test, but with Math::GMP
+t/biglog.t
+t/bigroot.t
+t/pod.t
+t/pod_cov.t
TODO
-GMP.xs
-build/README
-build/leak.pl
-build/leaktest
typemap
-Makefile.PL
-lib/Math/BigInt/GMP.pm
-t/bigintg.t # Math::GMP implementation of uint math core
-t/bigintpm.t # original test, but with Math::GMP
-t/bigintpm.inc # actual tests
-t/bigfltpm.t # original test, but with Math::GMP
-t/bigfltpm.inc # actual tests
-META.yml Module meta-data (added by MakeMaker)
Modified: trunk/libmath-bigint-gmp-perl/META.yml
URL: http://svn.debian.org/wsvn/trunk/libmath-bigint-gmp-perl/META.yml?rev=13996&op=diff
==============================================================================
--- trunk/libmath-bigint-gmp-perl/META.yml (original)
+++ trunk/libmath-bigint-gmp-perl/META.yml Fri Feb 1 17:49:43 2008
@@ -1,11 +1,12 @@
---- #YAML:1.0
+---
name: Math-BigInt-GMP
-version: 1.18
+author: Tels
+version: 1.24
version_from: lib/Math/BigInt/GMP.pm
license: perl
distribution_type: module
-generated_by: Math-BigInt-GMP version 1.18
+generated_by: Math-BigInt-GMP version 1.24
installdirs: site
requires:
- Math::BigInt: 1.76
+ Math::BigInt: 1.87
XSLoader: 0.02
Modified: trunk/libmath-bigint-gmp-perl/Makefile.PL
URL: http://svn.debian.org/wsvn/trunk/libmath-bigint-gmp-perl/Makefile.PL?rev=13996&op=diff
==============================================================================
--- trunk/libmath-bigint-gmp-perl/Makefile.PL (original)
+++ trunk/libmath-bigint-gmp-perl/Makefile.PL Fri Feb 1 17:49:43 2008
@@ -1,4 +1,16 @@
use ExtUtils::MakeMaker;
+
+#printf "Your OS is [%s]!\n---\n", $Config::Config{'osname'}; ### for testing purpose only
+
+if (($Config::Config{'osname'} eq 'darwin') &! (join (' ', @ARGV) =~ /LDDLFLAGS/))
+ {
+ ### reads pre-existing LDDLFLAGS for a darwin system as defined in
+ ### /System/Library/Perl/x.x.x/darwin-thread-multi-2level/Config.pm
+ ### where x.x.x is the perl version, which is 5.8.1 for MacOS X 10.3,
+ ### and appends ' -read_only_relocs suppress'
+ ### default behavior if LDDLFLAGS is defined
+ push @ARGV, sprintf "LDDLFLAGS=%s -read_only_relocs suppress", $Config::Config{'lddlflags'};
+ }
sub MY::metafile {
package MY;
@@ -9,9 +21,11 @@
return $self->SUPER::metafile_target(@_);
}
+ require YAML::Node;
my $node = new YAML::Node {};
$node->{name} = $self->{DISTNAME};
+ $node->{author} = 'Tels';
$node->{version} = $self->{VERSION};
$node->{version_from} = $self->{VERSION_FROM};
$node->{license} = 'perl';
@@ -25,15 +39,15 @@
$dump =~ s/^(.*)$/\t\$(NOECHO) \$(ECHO) "$1" >>META.yml/gm;
$dump =~ s/>>META\.yml/>META.yml/;
- return "metafile:\n$dump";
-}
+ "metafile:\n$dump";
+ }
WriteMakefile(
'NAME' => 'Math::BigInt::GMP',
- 'VERSION_FROM' => 'lib/Math/BigInt/GMP.pm', # finds $VERSION
+ 'VERSION_FROM' => 'lib/Math/BigInt/GMP.pm',
'PREREQ_PM' => {
- Math::BigInt => 1.76,
+ Math::BigInt => 1.87,
XSLoader => 0.02,
},
- 'LIBS' => ['-lgmp'], # e.g., '-lm'
+ 'LIBS' => ['-lgmp'],
);
Modified: trunk/libmath-bigint-gmp-perl/SIGNATURE
URL: http://svn.debian.org/wsvn/trunk/libmath-bigint-gmp-perl/SIGNATURE?rev=13996&op=diff
==============================================================================
--- trunk/libmath-bigint-gmp-perl/SIGNATURE (original)
+++ trunk/libmath-bigint-gmp-perl/SIGNATURE Fri Feb 1 17:49:43 2008
@@ -1,5 +1,5 @@
This file contains message digests of all files listed in MANIFEST,
-signed via the Module::Signature module, version 0.42.
+signed via the Module::Signature module, version 0.54.
To verify the content in this distribution, first make sure you have
Module::Signature installed, then type:
@@ -12,37 +12,42 @@
not run its Makefile.PL or Build.PL.
-----BEGIN PGP SIGNED MESSAGE-----
+Hash: SHA1
SHA1 70d6187d0152848c922dc4360fa6dd3a3dc35c62 BUGS
-SHA1 6b6bdc6293af028e86dbd63b6a580efcec4077f8 CHANGES
+SHA1 271b61ffaf1918eb85e45c4858226ccfbcb4862a CHANGES
SHA1 dda5ca4f413031e9efcaa1600461d5e2adaa3a40 CREDITS
-SHA1 c6b4374d7e911bd399534af9fa5ceb8c90dc6485 GMP.xs
-SHA1 1c219a49ee07891ca39de3f89ce4bbe02549af82 INSTALL
+SHA1 c677a382a0301544ac58c83a44e25a8d46b22452 GMP.xs
+SHA1 fcb1ead705a964b5555ff355534cbcf8b4c176e5 INSTALL
SHA1 d6a6c30ee6d9ba6b9afab8bbf6a25e1b23c744e0 LICENSE
-SHA1 6cd50151e6eab24927bce91ec062e6d71724ce63 MANIFEST
-SHA1 e6a410330f7e509a2a3e9939f4c092897a46f6d9 META.yml
-SHA1 3088c0112d5b30c3ab118a4bbe589015bc250c20 Makefile.PL
-SHA1 565caace9d59982d512f96b4a83c67837274688b NEW
+SHA1 574a4f3bc668e1d2d05c189efa46850bd828c79b MANIFEST
+SHA1 3716b684ad7f66e9f75a5cfa0737098b41dc0730 MANIFEST.SKIP
+SHA1 072edad617c9e588799181b23239508d734e8cec META.yml
+SHA1 7d63c7c9dfc21bd36110f9874a5a0c5a6c313adf Makefile.PL
SHA1 e9de29b6e5e9a5e446231b5b12b644f6ed2caafc README
-SHA1 200ade10e14449652ac59d0c8a9569cf29645cbd TODO
+SHA1 acf3dd42f0d8a87dd02ef9f5f74b894423ffd4d8 TODO
SHA1 fd48d0d8750eb949e485d8136b5b424fe73e9775 build/README
SHA1 7bcc4113830721ad6e37a1ea79df94a6987c836d build/leak.pl
SHA1 ac25bda8a6eb9058a9e42a8943c3e11b9fed88dc build/leaktest
-SHA1 d378c31028467583b1793be2b88a10beb3c6a702 lib/Math/BigInt/GMP.pm
-SHA1 1b842c489d03069f9bf329e659017fb2e76ee7c7 t/bigfltpm.inc
-SHA1 a94042649e8e752105e02718530eec6bdf19dda0 t/bigfltpm.t
-SHA1 9a2ec6e1e1a47a23092b4eb97301d6ea83dd35d8 t/bigintg.t
-SHA1 f88c1aa03a27bd230a72574a53a55101686bf62b t/bigintpm.inc
-SHA1 a53e9a5acc83925ac0e2d9243aba52e7beaf88bd t/bigintpm.t
-SHA1 f7aad87c0a30330d474f4fb45f6d1953d6701d2f typemap
+SHA1 ff5fe9462852f64ddadd111b3a12a74a19c84f5c lib/Math/BigInt/GMP.pm
+SHA1 b389295c7eb542fb89f55d37390a35ac582b5e6c t/bigfltpm.inc
+SHA1 a6659404498c1d7b74e055769710e00bf425e355 t/bigfltpm.t
+SHA1 0f8838bf47e9c21a95bc15db11f435836440525c t/bigintg.t
+SHA1 383a30546458b7a21e4f34aea66c2b813003c3db t/bigintpm.inc
+SHA1 9aaaaed58b9a32c0f44d3c531ee39ff1f0092f2c t/bigintpm.t
+SHA1 b68535cf9a33efa949c80b166302a866fd13cff9 t/biglog.t
+SHA1 7eda06bd6d27b4092ab7266b1659e3a6ed369b26 t/bigroot.t
+SHA1 17935f6d2607dfd441f6f59d69d5aaf282a16bfc t/pod.t
+SHA1 c7406b64a2eff28ca33248f647eee3199deb10dc t/pod_cov.t
+SHA1 af431c9de0cf037af2118a77c7110655fa3f427f typemap
-----BEGIN PGP SIGNATURE-----
-Version: GnuPG v1.2.4 (GNU/Linux)
+Version: GnuPG v1.4.2 (GNU/Linux)
-iQEVAwUBQlj95ncLPEOTuEwVAQGoMwf+JQUQFPfryG1oJAFDp9OP4QTc/c79mFhZ
-IgliIlae6VdrpZcuXnuz76N3V8Z+7IYvPuqJxfIhXxpYAl3r1rbOfxhsoKx4LHCV
-yLbgUfP4jvTXeFLcNU2ptVgMge4c1nyuSYb/eHLmnXT0MgRznHWRSAw6z2o5blk7
-edfJzHaKh8GhIOzReBMPhmQjpTeQ8xbDfNEAId+iPU5TeA7oba0zJYJEYGwVmF1e
-Pg56+5EiJZ5JIjLS1IGj5oa7E6l86HHioUgGRJZaYUSDN/6HmgKgRAy16fvxEDho
-BFdDKsmY8w9qiQQ7uKnxXBDNyiHBpOXn3vjCVF848SSGUEuHNhW+vA==
-=R9q1
+iQEVAwUBRq9VV3cLPEOTuEwVAQL8NQf/RSVGXcdNQqo3kgBv7S6mTXaigx2vXYlv
+rT828kebA4Kh2K+4+0Ye9Ol3utJG8gZgWToDhVn8xOcmEOxM5ZI/DncY5ipG3EgE
+ZZcbaQQ6K0jOlZPxBMUhA7TbWX+AjnyG5H/zAtuvneB+LHfbHy5F1rRgJOzgjkg+
+YZqcyYqmC2tHMpeZ5UZXPZujHLfTwlIH8hdt15fb9oiS6vGaky+e4iMSQM5LmRjD
+nXQN/yPwdQbNr/GB4333knl/WU5OBBcO4ynxvWMoHHZEECCTTPE+W7wj19Eogzl3
+D42zFB7NqUya8k+SEtAZ50BRGVjx0GJ6Yx8vRdwepmnZ4iOjhylUeg==
+=BeBy
-----END PGP SIGNATURE-----
Modified: trunk/libmath-bigint-gmp-perl/TODO
URL: http://svn.debian.org/wsvn/trunk/libmath-bigint-gmp-perl/TODO?rev=13996&op=diff
==============================================================================
--- trunk/libmath-bigint-gmp-perl/TODO (original)
+++ trunk/libmath-bigint-gmp-perl/TODO Fri Feb 1 17:49:43 2008
@@ -1,7 +1,11 @@
+
+ for _nok()
+* Function: int mpz_fits_ulong_p (mpz_t op)
+ Function: void mpz_bin_ui (mpz_t rop, mpz_t n, unsigned long int k)
* _lsft() and _rsft() could probably be a bit more optimized
* move _log_int() to XS
-* _digit() and _len() could be more optimized
+* _digit() should be in XS
* _zeros() could be more optimized (divide by 1e5, check for == 0?)
* replace all malloc() with New() and all free() with Savefree()?
Modified: trunk/libmath-bigint-gmp-perl/debian/changelog
URL: http://svn.debian.org/wsvn/trunk/libmath-bigint-gmp-perl/debian/changelog?rev=13996&op=diff
==============================================================================
--- trunk/libmath-bigint-gmp-perl/debian/changelog (original)
+++ trunk/libmath-bigint-gmp-perl/debian/changelog Fri Feb 1 17:49:43 2008
@@ -1,5 +1,6 @@
-libmath-bigint-gmp-perl (1.18-3) UNRELEASED; urgency=low
+libmath-bigint-gmp-perl (1.24-1) UNRELEASED; urgency=low
+ [ Damyan Ivanov ]
* debian/control: Added: Vcs-Svn field (source stanza); Vcs-Browser
field (source stanza); Homepage field (source stanza). Changed:
Maintainer set to Debian Perl Group <pkg-perl-
@@ -9,7 +10,10 @@
* Add debian/watch.
* debian/rules: delete /usr/share/perl5 only if it exists.
- -- Damyan Ivanov <dmn at debian.org> Fri, 01 Feb 2008 10:07:57 +0200
+ [ gregor herrmann ]
+ * New upstream release.
+
+ -- gregor herrmann <gregor+debian at comodo.priv.at> Fri, 01 Feb 2008 18:48:25 +0100
libmath-bigint-gmp-perl (1.18-2) unstable; urgency=low
Modified: trunk/libmath-bigint-gmp-perl/lib/Math/BigInt/GMP.pm
URL: http://svn.debian.org/wsvn/trunk/libmath-bigint-gmp-perl/lib/Math/BigInt/GMP.pm?rev=13996&op=diff
==============================================================================
--- trunk/libmath-bigint-gmp-perl/lib/Math/BigInt/GMP.pm (original)
+++ trunk/libmath-bigint-gmp-perl/lib/Math/BigInt/GMP.pm Fri Feb 1 17:49:43 2008
@@ -4,18 +4,18 @@
package Math::BigInt::GMP;
use strict;
-use 5.005;
+use 5.006002;
# use warnings; # dont use warnings for older Perls
use vars qw/$VERSION/;
-$VERSION = '1.18';
+$VERSION = '1.24';
use XSLoader;
XSLoader::load "Math::BigInt::GMP", $VERSION;
sub import { } # catch and throw away
-sub api_version() { 1; } # we are compatible with MBI v1.70 and up
+sub api_version() { 2; } # we are compatible with MBI v1.83 and up
BEGIN
{
@@ -23,16 +23,8 @@
*_str = \&_num;
}
+##############################################################################
# Routines not present here are in GMP.xs
-
-##############################################################################
-# testing
-
-sub _len
- {
- # return length, aka digits in decmial, costly!!
- length( Math::BigInt::GMP::_num(@_) );
- }
sub _digit
{
@@ -43,7 +35,7 @@
}
###############################################################################
-# check routine to test internal state of corruptions
+# routine to test internal state for corruptions
sub _check
{
@@ -79,11 +71,31 @@
return (_zero($c),undef);
}
- my $trial = _copy($c,$base);
+ # Compute a guess for the result based on:
+ # $guess = int ( length_in_base_10(X) / ( log(base) / log(10) ) )
+ my $len = _alen($c,$x);
+ my $log = log( _num($c,$base) ) / log(10);
+
+ # calculate now a guess based on the values obtained above:
my $x_org = _copy($c,$x);
- $x = _one($c);
- my $a;
+ # keep the reference to $x, modifying it in place
+ _set($c, $x, int($len / $log) - 1);
+
+ my $trial = _pow ($c, _copy($c, $base), $x);
+ my $a = _acmp($c,$trial,$x_org);
+
+ if ($a == 0)
+ {
+ return ($x,1);
+ }
+ elsif ($a > 0)
+ {
+ # too big, shouldn't happen
+ _div($c,$trial,$base); _dec($c, $x);
+ }
+
+ # find the real result by going forward:
my $base_mul = _mul($c, _copy($c,$base), $base);
my $two = _two($c);
@@ -134,7 +146,7 @@
=head1 AUTHOR
-Tels <http://bloodgate.com/> in 2001-2005.
+Tels <http://bloodgate.com/> in 2001-2007.
Thanx to Chip Turner for providing Math::GMP, which was inspiring my work.
Modified: trunk/libmath-bigint-gmp-perl/t/bigfltpm.inc
URL: http://svn.debian.org/wsvn/trunk/libmath-bigint-gmp-perl/t/bigfltpm.inc?rev=13996&op=diff
==============================================================================
--- trunk/libmath-bigint-gmp-perl/t/bigfltpm.inc (original)
+++ trunk/libmath-bigint-gmp-perl/t/bigfltpm.inc Fri Feb 1 17:49:43 2008
@@ -110,7 +110,7 @@
$try .= ", \$z" if (defined $args[2]);
$try .= " );";
} elsif ($f eq "fcmp") {
- $try .= '$x <=> $y;';
+ $try .= '$x->fcmp($y);';
} elsif ($f eq "facmp") {
$try .= '$x->facmp($y);';
} elsif ($f eq "fpow") {
@@ -762,6 +762,22 @@
-60123456789:9:-60123456800
+601234500:6:601234000
-601234500:6:-601234000
++60123456789.0123:5:60123000000
+-60123456789.0123:5:-60123000000
+$round_mode = "common"
++60123456789:5:60123000000
+-60123456789:5:-60123000000
++60123456789:6:60123500000
+-60123456789:6:-60123500000
++60123456789:9:60123456800
+-60123456789:9:-60123456800
++601234500:6:601235000
+-601234500:6:-601235000
++601234400:6:601234000
+-601234400:6:-601234000
++601234600:6:601235000
+-601234600:6:-601235000
++601234300:6:601234000
+60123456789.0123:5:60123000000
-60123456789.0123:5:-60123000000
&ffround
Modified: trunk/libmath-bigint-gmp-perl/t/bigfltpm.t
URL: http://svn.debian.org/wsvn/trunk/libmath-bigint-gmp-perl/t/bigfltpm.t?rev=13996&op=diff
==============================================================================
--- trunk/libmath-bigint-gmp-perl/t/bigfltpm.t (original)
+++ trunk/libmath-bigint-gmp-perl/t/bigfltpm.t Fri Feb 1 17:49:43 2008
@@ -9,7 +9,7 @@
unshift @INC, '../lib'; # for running manually
unshift @INC, '../blib/arch';
chdir 't' if -d 't';
- plan tests => 2012;
+ plan tests => 2042;
}
use Math::BigInt lib => 'GMP';
Modified: trunk/libmath-bigint-gmp-perl/t/bigintg.t
URL: http://svn.debian.org/wsvn/trunk/libmath-bigint-gmp-perl/t/bigintg.t?rev=13996&op=diff
==============================================================================
--- trunk/libmath-bigint-gmp-perl/t/bigintg.t (original)
+++ trunk/libmath-bigint-gmp-perl/t/bigintg.t Fri Feb 1 17:49:43 2008
@@ -9,7 +9,7 @@
chdir 't' if -d 't';
unshift @INC, '../lib'; # for running manually
unshift @INC, '../blib/arch'; # for running manually
- plan tests => 292;
+ plan tests => 356;
}
use Math::BigInt::GMP;
@@ -21,6 +21,13 @@
# _new and _str
my $x = $C->_new("123"); my $y = $C->_new("321");
ok (ref($x),'Math::BigInt::GMP'); ok ($C->_str($x),123); ok ($C->_str($y),321);
+
+###############################################################################
+# _set
+
+my $b = $C->_new("123");
+$C->_set($b,12);
+ok ($C->_str($b),12);
###############################################################################
# _add, _sub, _mul, _div
@@ -105,34 +112,63 @@
ok ($C->_is_odd($C->_one()),1); ok ($C->_is_odd($C->_zero())||0,0);
ok ($C->_is_even($C->_one()) || 0,0); ok ($C->_is_even($C->_zero()),1);
-# _len
-$x = $C->_new("1"); ok ($C->_len($x),1);
-$x = $C->_new("12"); ok ($C->_len($x),2);
-$x = $C->_new("123"); ok ($C->_len($x),3);
-$x = $C->_new("1234"); ok ($C->_len($x),4);
-$x = $C->_new("12345"); ok ($C->_len($x),5);
-$x = $C->_new("123456"); ok ($C->_len($x),6);
-$x = $C->_new("1234567"); ok ($C->_len($x),7);
-$x = $C->_new("12345678"); ok ($C->_len($x),8);
-$x = $C->_new("123456789"); ok ($C->_len($x),9);
-
-$x = $C->_new("8"); ok ($C->_len($x),1);
-$x = $C->_new("21"); ok ($C->_len($x),2);
-$x = $C->_new("321"); ok ($C->_len($x),3);
-$x = $C->_new("4321"); ok ($C->_len($x),4);
-$x = $C->_new("54321"); ok ($C->_len($x),5);
-$x = $C->_new("654321"); ok ($C->_len($x),6);
-$x = $C->_new("7654321"); ok ($C->_len($x),7);
-$x = $C->_new("87654321"); ok ($C->_len($x),8);
-$x = $C->_new("987654321"); ok ($C->_len($x),9);
-
-for (my $i = 1; $i < 9; $i++)
- {
- my $a = "$i" . '0' x ($i-1);
- $x = $C->_new($a);
- print "# Tried len '$a'\n" unless ok ($C->_len($x),$i);
- }
-
+sub _check_len
+ {
+ my ($y, $m) = @_;
+
+ my $len = length($y);
+ $x = $C->_new($y);
+ if ($m eq '_len')
+ {
+ ok ($C->$m($x),$len);
+ }
+ else
+ {
+ # equal or at most one bigger
+ print STDERR "# $len $y". $C->$m($x). "\n" unless
+ ok ($len - $C->$m($x) <= 1, 1);
+ }
+ }
+
+# _len and _alen
+for my $m (qw/_len _alen/)
+ {
+ _check_len("1",$m);
+ _check_len("12",$m);
+ _check_len("123",$m);
+ _check_len("1234",$m);
+ _check_len("12345",$m);
+ _check_len("123456",$m);
+ _check_len("1234567",$m);
+ _check_len("12345678",$m);
+ _check_len("123456789",$m);
+ _check_len("1234567890",$m);
+ _check_len("7",$m);
+ _check_len("8",$m);
+ _check_len("9",$m);
+ _check_len("10",$m);
+ _check_len("11",$m);
+ _check_len("21",$m);
+ _check_len("321",$m);
+ _check_len("320",$m);
+ _check_len("4321",$m);
+ _check_len("54321",$m);
+ _check_len("654321",$m);
+ _check_len("7654321",$m);
+ _check_len("7654321",$m);
+ _check_len("87654321",$m);
+ _check_len("987654321",$m);
+ _check_len("9876543219876543210",$m);
+ _check_len("1234567890" x 10,$m);
+ _check_len("1234567890" x 100,$m);
+
+ for (my $i = 1; $i < 9; $i++)
+ {
+ my $a = "$i" . '0' x ($i-1);
+ _check_len($a,$m);
+ }
+ }
+
# _digit
$x = $C->_new("123456789");
ok ($C->_digit($x,0),9);
@@ -156,6 +192,9 @@
$x = $C->_new("123000"); ok ($C->_zeros($x),3);
$x = $C->_new("123001"); ok ($C->_zeros($x),0);
$x = $C->_new("1"); ok ($C->_zeros($x),0);
+$x = $C->_new("8"); ok ($C->_zeros($x),0);
+$x = $C->_new("10"); ok ($C->_zeros($x),1);
+$x = $C->_new("11"); ok ($C->_zeros($x),0);
$x = $C->_new("0"); ok ($C->_zeros($x),0);
# _lsft, _rsft
@@ -351,10 +390,14 @@
my ($r, $exact) = $C->_log_int($x, $C->_new("3"));
ok ($C->_str( $r ), '4');
+ok ($C->_str( $x ), '4');
ok ($exact, 1);
+$x = $C->_new("81");
+
($r, $exact) = $C->_log_int($x,3);
ok ($C->_str( $r ), '4');
+ok ($C->_str( $x ), '4');
ok ($exact, 1);
###############################################################################
@@ -386,6 +429,23 @@
ok ($C->_as_hex( $C->_new("12")), '0xc');
ok ($C->_as_bin( $C->_new("12")), '0b1100');
+# _from_oct
+$x = $C->_from_oct("001"); ok ($C->_str($x),'1');
+$x = $C->_from_oct("07"); ok ($C->_str($x),'7');
+$x = $C->_from_oct("077"); ok ($C->_str($x),'63');
+$x = $C->_from_oct("07654321"); ok ($C->_str($x),'2054353');
+# _as_oct
+$x = $C->_new("2054353"); ok ($C->_as_oct($x),'07654321');
+$x = $C->_new("63"); ok ($C->_as_oct($x),'077');
+$x = $C->_new("0"); ok ($C->_as_oct($x),'00');
+
+# _1ex
+ok ($C->_str($C->_1ex(0)), "1");
+ok ($C->_str($C->_1ex(1)), "10");
+ok ($C->_str($C->_1ex(2)), "100");
+ok ($C->_str($C->_1ex(12)), "1000000000000");
+ok ($C->_str($C->_1ex(16)), "10000000000000000");
+
# _check
$x = $C->_new("123456789");
ok ($C->_check($x),0);
Modified: trunk/libmath-bigint-gmp-perl/t/bigintpm.inc
URL: http://svn.debian.org/wsvn/trunk/libmath-bigint-gmp-perl/t/bigintpm.inc?rev=13996&op=diff
==============================================================================
--- trunk/libmath-bigint-gmp-perl/t/bigintpm.inc (original)
+++ trunk/libmath-bigint-gmp-perl/t/bigintpm.inc Fri Feb 1 17:49:43 2008
@@ -89,12 +89,14 @@
$try .= '$m = $m->bstr(); $m = "NaN" if !defined $m;';
$try .= '$e = $e->bstr(); $e = "NaN" if !defined $e;';
$try .= '"$m,$e";';
+ }elsif ($f eq "bexp"){
+ $try .= "\$x->bexp();";
} else {
# binary ops
$try .= "\$y = $class->new('$args[1]');";
if ($f eq "bcmp")
{
- $try .= '$x <=> $y;';
+ $try .= '$x->bcmp($y);';
} elsif ($f eq "bround") {
$try .= "$round_mode; \$x->bround(\$y);";
} elsif ($f eq "bacmp"){
@@ -154,6 +156,8 @@
{
$try .= "\$x >> \$y;";
}
+ }elsif ($f eq "bnok"){
+ $try .= "\$x->bnok(\$y);";
}elsif ($f eq "broot"){
$try .= "\$x->broot(\$y);";
}elsif ($f eq "blog"){
@@ -1497,6 +1501,8 @@
1234567890999999999:9876543210:124999998,9503086419
1234567890000000000:9876543210:124999998,8503086420
96969696969696969696969696969678787878626262626262626262626262:484848484848484848484848486666666666666689898989898989898989:199,484848484848484848484848123012121211954972727272727272727451
+# bug in v1.76
+1267650600228229401496703205375:1267650600228229401496703205376:0,1267650600228229401496703205375
# excercise shortcut for numbers of the same length in div
999999999999999999999999999999999:999999999999999999999999999999999:1,0
999999999999999999999999999999999:888888888888888888888888888888888:1,111111111111111111111111111111111
@@ -2036,6 +2042,9 @@
10:3628800
11:39916800
12:479001600
+20:2432902008176640000
+22:1124000727777607680000
+69:171122452428141311372468338881272839092270544893520369393648040923257279754140647424000000000000000
&bpow
abc:12:NaN
12:abc:NaN
@@ -2187,7 +2196,7 @@
18446744073709551616:128:1
# 213 ** 15
84274086103068221283760416414557757:15:213
-# see t/bigroot for more tests
+# see t/bigroot.t for more tests
&bsqrt
145:12
144:12
@@ -2217,6 +2226,29 @@
Nan:NaN
+inf:inf
-inf:NaN
+# see t/biglog.t for more tests
+&bexp
+NaN:NaN
+inf:inf
+1:2
+2:7
+# see t/bignok.t for more tests
+&bnok
++inf:10:inf
+NaN:NaN:NaN
+NaN:1:NaN
+1:NaN:NaN
+1:1:1
+# k > n
+1:2:0
+2:3:0
+# k < 0
+1:-2:0
+# 7 over 3 = 35
+7:3:35
+7:6:1
+100:90:17310309456440
+100:95:75287520
&bround
$round_mode('trunc')
0:12:0
@@ -2297,6 +2329,27 @@
+1234567:6:1234570
+12345000:4:12340000
-12345000:4:-12340000
+$round_mode('common')
++60123456789:5:60123000000
++60123199999:5:60123000000
++60123299999:5:60123000000
++60123399999:5:60123000000
++60123499999:5:60123000000
++60123500000:5:60124000000
++60123600000:5:60124000000
++60123700000:5:60124000000
++60123800000:5:60124000000
++60123900000:5:60124000000
+-60123456789:5:-60123000000
+-60123199999:5:-60123000000
+-60123299999:5:-60123000000
+-60123399999:5:-60123000000
+-60123499999:5:-60123000000
+-60123500000:5:-60124000000
+-60123600000:5:-60124000000
+-60123700000:5:-60124000000
+-60123800000:5:-60124000000
+-60123900000:5:-60124000000
&is_zero
0:1
NaNzero:0
Modified: trunk/libmath-bigint-gmp-perl/t/bigintpm.t
URL: http://svn.debian.org/wsvn/trunk/libmath-bigint-gmp-perl/t/bigintpm.t?rev=13996&op=diff
==============================================================================
--- trunk/libmath-bigint-gmp-perl/t/bigintpm.t (original)
+++ trunk/libmath-bigint-gmp-perl/t/bigintpm.t Fri Feb 1 17:49:43 2008
@@ -11,7 +11,7 @@
unshift @INC, $location; # to locate the testing files
unshift @INC, '../blib/arch';
chdir 't' if -d 't';
- plan tests => 2964;
+ plan tests => 3043;
}
use Math::BigInt lib => 'GMP';
Modified: trunk/libmath-bigint-gmp-perl/typemap
URL: http://svn.debian.org/wsvn/trunk/libmath-bigint-gmp-perl/typemap?rev=13996&op=diff
==============================================================================
--- trunk/libmath-bigint-gmp-perl/typemap (original)
+++ trunk/libmath-bigint-gmp-perl/typemap Fri Feb 1 17:49:43 2008
@@ -4,11 +4,11 @@
MPZ
if (sv_derived_from($arg, \"Math::BigInt::GMP\")) {
IV tmp = SvIV((SV*)SvRV($arg));
- $var = ($type) tmp;
+ $var = INT2PTR($type, tmp);
}
else
croak(\"$var is not of type Math::BigInt::GMP\")
OUTPUT
MPZ
- sv_setref_pv($arg, \"Math::BigInt::GMP\", (void*)$var);
+ sv_setref_pv($arg, \"Math::BigInt::GMP\", INT2PTR(void*, $var));
More information about the Pkg-perl-cvs-commits
mailing list