Commit 31dfea79 authored by gregor herrmann's avatar gregor herrmann

Update upstream source from tag 'upstream/1.999813'

Update to upstream version '1.999813'
with Debian dir 1827d453b3c8b52b9209a6b7412acc0992c3aece
parents 87e50937 5d393f3b
This diff is collapsed.
......@@ -19,9 +19,9 @@ provided helpfull feedback.
Secondary goals:
* Make mixing of classes work, like in:
$x = Math::BigFloat->new(10);
$y = Math::BigInt->new(2);
$z = $x / $y; # $z = Math::BigFloat = 5
$x = Math::BigFloat->new(10);
$y = Math::BigInt->new(2);
$z = $x / $y; # $z = Math::BigFloat = 5
* Make auto-upgrading/downgrading work
See also BUGS.
......
......@@ -19,8 +19,6 @@ NEW
README
t/00sig.t
t/01load.t
t/02pod.t
t/03podcov.t
t/_e_math.t
t/alias.inc
t/author-batan-mbf.t
......@@ -32,6 +30,7 @@ t/author-bmod-bdiv-mbi.t
t/author-bnok-mbi.t
t/author-bpi-mbf.t
t/author-btmod-btdiv-mbi.t
t/author-constructors-a-p-r.t
t/author-lib-arithmetic-binary-_add.dat
t/author-lib-arithmetic-binary-_add.t
t/author-lib-arithmetic-binary-_div.dat
......@@ -190,6 +189,11 @@ t/nparts-mbf.t
t/nparts-mbi.t
t/objectify_mbf.t
t/objectify_mbi.t
t/release-cpan-changes.t
t/release-pod-coverage.t
t/release-pod.t
t/release-portability.t
t/release-whitespaces.t
t/req_mbf0.t
t/req_mbf1.t
t/req_mbfa.t
......
.*\.tar\.gz
^blib.*
^\w+\.(html|txt|png|dot|pl|svg|old|bak|org)
^Makefile\z
^Makefile.(old|bak)\z
^MANIFEST.(old|bak)\z
^MYMETA\.(yml|json)\z
pm_to_blib
\.git
\.*tmp
.*\.patch\z
^Math-BigInt-
~\z
#!start included /usr/share/perl5/5.26/ExtUtils/MANIFEST.SKIP
# Avoid version control files.
\bRCS\b
\bCVS\b
\bSCCS\b
,v$
\B\.svn\b
\B\.git\b
\B\.gitignore\b
\b_darcs\b
\B\.cvsignore$
# Avoid VMS specific MakeMaker generated files
\bDescrip.MMS$
\bDESCRIP.MMS$
\bdescrip.mms$
# Avoid Makemaker generated and utility files.
\bMANIFEST\.bak
\bMakefile$
\bblib/
\bMakeMaker-\d
\bpm_to_blib\.ts$
\bpm_to_blib$
\bblibdirs\.ts$ # 6.18 through 6.25 generated this
\b_eumm/ # 7.05_05 and above
# Avoid Module::Build generated and utility files.
\bBuild$
\b_build/
\bBuild.bat$
\bBuild.COM$
\bBUILD.COM$
\bbuild.com$
# and Module::Build::Tiny generated files
\b_build_params$
# Avoid temp and backup files.
~$
\.old$
\#$
\b\.#
\.bak$
\.tmp$
\.#
\.rej$
\..*\.sw.?$
# Avoid OS-specific files/dirs
# Mac OSX metadata
\B\.DS_Store
# Mac OSX SMB mount metadata files
\B\._
# Avoid Devel::Cover and Devel::CoverX::Covered files.
\bcover_db\b
\bcovered\b
# Avoid prove files
\B\.prove$
# Avoid MYMETA files
^MYMETA\.
#!end included /usr/share/perl5/5.26/ExtUtils/MANIFEST.SKIP
# Avoid distribution-specific stuff.
^Math-BigInt-[0-9]
......@@ -4,13 +4,13 @@
"Peter John Acklam <pjacklam@gmail.com>"
],
"dynamic_config" : 1,
"generated_by" : "ExtUtils::MakeMaker version 7.24, CPAN::Meta::Converter version 2.150010",
"generated_by" : "ExtUtils::MakeMaker version 7.34, CPAN::Meta::Converter version 2.150010",
"license" : [
"perl_5"
],
"meta-spec" : {
"url" : "http://search.cpan.org/perldoc?CPAN::Meta::Spec",
"version" : "2"
"version" : 2
},
"name" : "Math-BigInt",
"no_index" : {
......@@ -39,6 +39,6 @@
}
},
"release_status" : "stable",
"version" : "1.999811",
"x_serialization_backend" : "JSON::PP version 2.27400"
"version" : "1.999813",
"x_serialization_backend" : "JSON::PP version 2.97001"
}
......@@ -7,7 +7,7 @@ build_requires:
configure_requires:
ExtUtils::MakeMaker: '0'
dynamic_config: 1
generated_by: 'ExtUtils::MakeMaker version 7.24, CPAN::Meta::Converter version 2.150010'
generated_by: 'ExtUtils::MakeMaker version 7.34, CPAN::Meta::Converter version 2.150010'
license: perl
meta-spec:
url: http://module-build.sourceforge.net/META-spec-v1.4.html
......@@ -21,5 +21,5 @@ requires:
Math::Complex: '1.39'
Test::More: '0.94'
perl: '5.006001'
version: '1.999811'
version: '1.999813'
x_serialization_backend: 'CPAN::Meta::YAML version 0.018'
This diff is collapsed.
......@@ -3,8 +3,8 @@
use Test;
BEGIN { plan tests => 17; }
use lib '../lib'; # comment out to use old module
#use lib '../../old/Math-BigInt-0.01/lib'; # for old version
use lib '../lib'; # comment out to use old module
#use lib '../../old/Math-BigInt-0.01/lib'; # for old version
use strict;
#use Math::BigInt;
......@@ -26,14 +26,13 @@ my $two = Math::BigInt->new(2);
# Also there is len(), since the old BigInt has not got length() and we want
# this script to be comparable between old and new version.
##############################################################################
# Todo: these do not complete in reasonable time:
# $x = $two ** 6972593; $x--; #ok (len($x),'2098960');
# $x = $two ** 3021377; $x--; #ok (len($x),'909526');
# $x = $two ** 756839; $x--; #ok (len($x),'227832');
# $x = 1041870 ** 32768; $x++; #ok (len($x),'197192');
# $x = 1041870 ** 32768; $x++; #ok (len($x),'197192');
##############################################################################
# but these do:
......@@ -71,7 +70,6 @@ $x *= '14193959303';
$x = (2**3833-1) / $x;
ok (len($x),'1121');
#(2^4751-1)/(268982617*3274778783*629530076753*81630665742097*1507074535068001)
$x = Math::BigInt->new('268982617');
$x = $x * '3274778783' * '629530076753' * '81630665742097' * '1507074535068001';
......
#!/usr/bin/perl -w
BEGIN { unshift @INC, '../lib'; } # uncomment to use old, org version
BEGIN { unshift @INC, '../lib'; } # uncomment to use old, org version
$| = 1;
......@@ -13,13 +13,13 @@ use Math::BigInt;
$amount = Math::BigInt->new( shift || 1000000 );
@primes = (1,1,0); # any not defined number is prime, 0,1 are not, but 2 is
my $prime = Math::BigInt->new (3); # start
my $prime = Math::BigInt->new (3); # start
# the loop below is faster in the old version than in the new, since it is
# the worst case for new lib: small numbers and lot's of bstr()/new().
# It also slows down the benchmark too much so we use slightly faster int here
$r = 0; my $a = $amount->numify();
for ($i = 3; $i < $a; $i++) # int version
for ($i = 3; $i < $a; $i++) # int version
{
$primes[$i] = $r; $r = 1-$r;
}
......@@ -32,14 +32,14 @@ while ($prime < $amount)
$cur = $prime;
while ($primes[$cur])
{
$cur += 2; last OUTER if $cur >= $amount; # no more to do
$cur += 2; last OUTER if $cur >= $amount; # no more to do
}
# $cur is now new prime
$str = "$cur"; $str =~ s/\+//; # unify output for comapre
#print "$str $prime $amount\n";
# now strike out all multiples of $cur
$add = $cur*2;
$prime = $cur + 2; # next round start two higher
$prime = $cur + 2; # next round start two higher
$cur += $add;
while ($cur < $amount)
{
......@@ -58,7 +58,6 @@ foreach (@primes)
print "last prime: $real_primes[-1]\n";
# check against text
open FILE, '1000.txt' or die "Can't read 1000.txt: $!";
my @test;
......
This diff is collapsed.
This diff is collapsed.
......@@ -4,10 +4,10 @@ use 5.006001;
use strict;
use warnings;
use Carp;
use Carp qw< carp croak >;
use Math::BigInt::Lib;
our $VERSION = '1.999811';
our $VERSION = '1.999813';
our @ISA = ('Math::BigInt::Lib');
......@@ -104,8 +104,7 @@ sub _new {
my ($class, $str) = @_;
#unless ($str =~ /^([1-9]\d*|0)\z/) {
# require Carp;
# Carp::croak("Invalid input string '$str'");
# croak("Invalid input string '$str'");
#}
my $input_len = length($str) - 1;
......@@ -264,8 +263,7 @@ sub _str {
my $idx = $#$ary; # index of last element
if ($idx < 0) { # should not happen
require Carp;
Carp::croak("$_[1] has no elements");
croak("$_[1] has no elements");
}
# Handle first one differently, since it should not have any leading zeros.
......@@ -693,7 +691,7 @@ sub _div_use_mul {
my $y = $c->_copy($yorg); # always make copy to preserve
my ($car, $bar, $prd, $dd, $xi, $yi, @q, $v2, $v1, @d, $tmp, $q, $u2, $u1, $u0);
my ($car, $bar, $prd, $dd, $xi, $yi, @q, $v2, $v1, $tmp, $q, $u2, $u1, $u0);
$car = $bar = $prd = 0;
if (($dd = int($BASE / ($y->[-1] + 1))) != 1) {
......@@ -858,7 +856,7 @@ sub _div_use_div_64 {
my $y = $c->_copy($yorg); # always make copy to preserve
my ($car, $bar, $prd, $dd, $xi, $yi, @q, $v2, $v1, @d, $tmp, $q, $u2, $u1, $u0);
my ($car, $bar, $prd, $dd, $xi, $yi, @q, $v2, $v1, $tmp, $q, $u2, $u1, $u0);
$car = $bar = $prd = 0;
if (($dd = int($BASE / ($y->[-1] + 1))) != 1) {
......@@ -2045,7 +2043,6 @@ sub _root {
elsif ($acmp > 0) {
$upper = $y;
my $zero = $c -> _zero();
while ($acmp > 0) {
if ($c -> _acmp($upper, $delta) <= 0) {
$lower = $c -> _zero();
......
......@@ -4,7 +4,7 @@ use 5.006001;
use strict;
use warnings;
our $VERSION = '1.999811';
our $VERSION = '1.999813';
package Math::BigInt;
......@@ -25,34 +25,34 @@ sub __emu_band
return $x->bzero(@r) if $y->is_zero() || $x->is_zero();
my $sign = 0; # sign of result
my $sign = 0; # sign of result
$sign = 1 if $sx == -1 && $sy == -1;
my ($bx,$by);
if ($sx == -1) # if x is negative
if ($sx == -1) # if x is negative
{
# two's complement: inc and flip all "bits" in $bx
$bx = $x->binc()->as_hex(); # -1 => 0, -2 => 1, -3 => 2 etc
$bx = $x->binc()->as_hex(); # -1 => 0, -2 => 1, -3 => 2 etc
$bx =~ s/-?0x//;
$bx =~ tr/0123456789abcdef/\x0f\x0e\x0d\x0c\x0b\x0a\x09\x08\x07\x06\x05\x04\x03\x02\x01\x00/;
}
else
{
$bx = $x->as_hex(); # get binary representation
$bx = $x->as_hex(); # get binary representation
$bx =~ s/-?0x//;
$bx =~ tr/fedcba9876543210/\x0f\x0e\x0d\x0c\x0b\x0a\x09\x08\x07\x06\x05\x04\x03\x02\x01\x00/;
}
if ($sy == -1) # if y is negative
if ($sy == -1) # if y is negative
{
# two's complement: inc and flip all "bits" in $by
$by = $y->copy()->binc()->as_hex(); # -1 => 0, -2 => 1, -3 => 2 etc
$by = $y->copy()->binc()->as_hex(); # -1 => 0, -2 => 1, -3 => 2 etc
$by =~ s/-?0x//;
$by =~ tr/0123456789abcdef/\x0f\x0e\x0d\x0c\x0b\x0a\x09\x08\x07\x06\x05\x04\x03\x02\x01\x00/;
}
else
{
$by = $y->as_hex(); # get binary representation
$by = $y->as_hex(); # get binary representation
$by =~ s/-?0x//;
$by =~ tr/fedcba9876543210/\x0f\x0e\x0d\x0c\x0b\x0a\x09\x08\x07\x06\x05\x04\x03\x02\x01\x00/;
}
......@@ -112,34 +112,34 @@ sub __emu_bior
return $x->round(@r) if $y->is_zero();
my $sign = 0; # sign of result
my $sign = 0; # sign of result
$sign = 1 if ($sx == -1) || ($sy == -1);
my ($bx,$by);
if ($sx == -1) # if x is negative
if ($sx == -1) # if x is negative
{
# two's complement: inc and flip all "bits" in $bx
$bx = $x->binc()->as_hex(); # -1 => 0, -2 => 1, -3 => 2 etc
$bx = $x->binc()->as_hex(); # -1 => 0, -2 => 1, -3 => 2 etc
$bx =~ s/-?0x//;
$bx =~ tr/0123456789abcdef/\x0f\x0e\x0d\x0c\x0b\x0a\x09\x08\x07\x06\x05\x04\x03\x02\x01\x00/;
}
else
{
$bx = $x->as_hex(); # get binary representation
$bx = $x->as_hex(); # get binary representation
$bx =~ s/-?0x//;
$bx =~ tr/fedcba9876543210/\x0f\x0e\x0d\x0c\x0b\x0a\x09\x08\x07\x06\x05\x04\x03\x02\x01\x00/;
}
if ($sy == -1) # if y is negative
if ($sy == -1) # if y is negative
{
# two's complement: inc and flip all "bits" in $by
$by = $y->copy()->binc()->as_hex(); # -1 => 0, -2 => 1, -3 => 2 etc
$by = $y->copy()->binc()->as_hex(); # -1 => 0, -2 => 1, -3 => 2 etc
$by =~ s/-?0x//;
$by =~ tr/0123456789abcdef/\x0f\x0e\x0d\x0c\x0b\x0a\x09\x08\x07\x06\x05\x04\x03\x02\x01\x00/;
}
else
{
$by = $y->as_hex(); # get binary representation
$by = $y->as_hex(); # get binary representation
$by =~ s/-?0x//;
$by =~ tr/fedcba9876543210/\x0f\x0e\x0d\x0c\x0b\x0a\x09\x08\x07\x06\x05\x04\x03\x02\x01\x00/;
}
......@@ -198,34 +198,34 @@ sub __emu_bxor
return $x->round(@r) if $y->is_zero();
my $sign = 0; # sign of result
my $sign = 0; # sign of result
$sign = 1 if $x->{sign} ne $y->{sign};
my ($bx,$by);
if ($sx == -1) # if x is negative
if ($sx == -1) # if x is negative
{
# two's complement: inc and flip all "bits" in $bx
$bx = $x->binc()->as_hex(); # -1 => 0, -2 => 1, -3 => 2 etc
$bx = $x->binc()->as_hex(); # -1 => 0, -2 => 1, -3 => 2 etc
$bx =~ s/-?0x//;
$bx =~ tr/0123456789abcdef/\x0f\x0e\x0d\x0c\x0b\x0a\x09\x08\x07\x06\x05\x04\x03\x02\x01\x00/;
}
else
{
$bx = $x->as_hex(); # get binary representation
$bx = $x->as_hex(); # get binary representation
$bx =~ s/-?0x//;
$bx =~ tr/fedcba9876543210/\x0f\x0e\x0d\x0c\x0b\x0a\x09\x08\x07\x06\x05\x04\x03\x02\x01\x00/;
}
if ($sy == -1) # if y is negative
if ($sy == -1) # if y is negative
{
# two's complement: inc and flip all "bits" in $by
$by = $y->copy()->binc()->as_hex(); # -1 => 0, -2 => 1, -3 => 2 etc
$by = $y->copy()->binc()->as_hex(); # -1 => 0, -2 => 1, -3 => 2 etc
$by =~ s/-?0x//;
$by =~ tr/0123456789abcdef/\x0f\x0e\x0d\x0c\x0b\x0a\x09\x08\x07\x06\x05\x04\x03\x02\x01\x00/;
}
else
{
$by = $y->as_hex(); # get binary representation
$by = $y->as_hex(); # get binary representation
$by =~ s/-?0x//;
$by =~ tr/fedcba9876543210/\x0f\x0e\x0d\x0c\x0b\x0a\x09\x08\x07\x06\x05\x04\x03\x02\x01\x00/;
}
......@@ -292,7 +292,7 @@ Math::BigInt::CalcEmu - Emulate low-level math with BigInt code
=head1 SYNOPSIS
use Math::BigInt::CalcEmu;
use Math::BigInt::CalcEmu;
=head1 DESCRIPTION
......
......@@ -4,7 +4,7 @@ use 5.006001;
use strict;
use warnings;
our $VERSION = '1.999811';
our $VERSION = '1.999813';
use Carp;
......
......@@ -223,8 +223,8 @@ sub _digit {
# 0 is the rightmost digit
my ($c, $x, $n) = @_;
$n ++; # 0 => 1, 1 => 2
return substr($$x, -$n, 1); # 1 => -1, -2 => 2 etc
$n ++; # 0 => 1, 1 => 2
return substr($$x, -$n, 1); # 1 => -1, -2 => 2 etc
}
##############################################################################
......
......@@ -2,9 +2,8 @@
BEGIN {
unless ($ENV{AUTHOR_TESTING}) {
require Test::More;
Test::More::plan(skip_all =>
'these tests are for testing by the author');
print "1..0 # SKIP these tests are for testing by the author";
exit;
}
}
......
......@@ -2,9 +2,8 @@
BEGIN {
unless ($ENV{AUTHOR_TESTING}) {
require Test::More;
Test::More::plan(skip_all =>
'these tests are for testing by the author');
print "1..0 # SKIP these tests are for testing by the author";
exit;
}
}
......
......@@ -2,9 +2,8 @@
BEGIN {
unless ($ENV{AUTHOR_TESTING}) {
require Test::More;
Test::More::plan(skip_all =>
'these tests are for testing by the author');
print "1..0 # SKIP these tests are for testing by the author";
exit;
}
}
......
......@@ -2,9 +2,8 @@
BEGIN {
unless ($ENV{AUTHOR_TESTING}) {
require Test::More;
Test::More::plan(skip_all =>
'these tests are for testing by the author');
print "1..0 # SKIP these tests are for testing by the author";
exit;
}
}
......
......@@ -2,9 +2,8 @@
BEGIN {
unless ($ENV{AUTHOR_TESTING}) {
require Test::More;
Test::More::plan(skip_all =>
'these tests are for testing by the author');
print "1..0 # SKIP these tests are for testing by the author";
exit;
}
}
......
......@@ -2,9 +2,8 @@
BEGIN {
unless ($ENV{AUTHOR_TESTING}) {
require Test::More;
Test::More::plan(skip_all =>
'these tests are for testing by the author');
print "1..0 # SKIP these tests are for testing by the author";
exit;
}
}
......
......@@ -2,9 +2,8 @@
BEGIN {
unless ($ENV{AUTHOR_TESTING}) {
require Test::More;
Test::More::plan(skip_all =>
'these tests are for testing by the author');
print "1..0 # SKIP these tests are for testing by the author";
exit;
}
}
......
......@@ -2,9 +2,8 @@
BEGIN {
unless ($ENV{AUTHOR_TESTING}) {
require Test::More;
Test::More::plan(skip_all =>
'these tests are for testing by the author');
print "1..0 # SKIP these tests are for testing by the author";
exit;
}
}
......
......@@ -2,9 +2,8 @@
BEGIN {
unless ($ENV{AUTHOR_TESTING}) {
require Test::More;
Test::More::plan(skip_all =>
'these tests are for testing by the author');
print "1..0 # SKIP these tests are for testing by the author";
exit;
}
}
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.