diff options
author | Florian Ragwitz <rafl@debian.org> | 2010-10-23 17:18:25 -0700 |
---|---|---|
committer | Florian Ragwitz <rafl@debian.org> | 2010-10-24 10:52:46 -0700 |
commit | ccbfef1989966a87df0683fb781de40d0fad1f84 (patch) | |
tree | b7b1c31cb6a8b7cb1b8962fbea11a2c509b6e783 | |
parent | dbe2fffcb043e3f633e8c31acbe8a158c7083248 (diff) | |
download | perl-ccbfef1989966a87df0683fb781de40d0fad1f84.tar.gz |
Math::BigRat has blead as its upstream
-rw-r--r-- | MANIFEST | 28 | ||||
-rwxr-xr-x | Porting/Maintainers.pl | 4 | ||||
-rw-r--r-- | dist/Math-BigRat/lib/Math/BigRat.pm (renamed from cpan/Math-BigRat/lib/Math/BigRat.pm) | 84 | ||||
-rw-r--r-- | dist/Math-BigRat/t/Math/BigRat/Test.pm (renamed from cpan/Math-BigRat/t/Math/BigRat/Test.pm) | 6 | ||||
-rw-r--r-- | dist/Math-BigRat/t/big_ap.t (renamed from cpan/Math-BigRat/t/big_ap.t) | 1 | ||||
-rw-r--r-- | dist/Math-BigRat/t/bigfltpm.inc (renamed from cpan/Math-BigRat/t/bigfltpm.inc) | 22 | ||||
-rw-r--r-- | dist/Math-BigRat/t/bigfltrt.t (renamed from cpan/Math-BigRat/t/bigfltrt.t) | 4 | ||||
-rw-r--r-- | dist/Math-BigRat/t/biglog.t (renamed from cpan/Math-BigRat/t/biglog.t) | 13 | ||||
-rw-r--r-- | dist/Math-BigRat/t/bigrat.t (renamed from cpan/Math-BigRat/t/bigrat.t) | 9 | ||||
-rw-r--r-- | dist/Math-BigRat/t/bigratpm.inc (renamed from cpan/Math-BigRat/t/bigratpm.inc) | 6 | ||||
-rw-r--r-- | dist/Math-BigRat/t/bigratpm.t (renamed from cpan/Math-BigRat/t/bigratpm.t) | 2 | ||||
-rw-r--r-- | dist/Math-BigRat/t/bigratup.t (renamed from cpan/Math-BigRat/t/bigratup.t) | 1 | ||||
-rw-r--r-- | dist/Math-BigRat/t/bigroot.t (renamed from cpan/Math-BigRat/t/bigroot.t) | 3 | ||||
-rw-r--r-- | dist/Math-BigRat/t/hang.t (renamed from cpan/Math-BigRat/t/hang.t) | 1 | ||||
-rw-r--r-- | dist/Math-BigRat/t/requirer.t (renamed from cpan/Math-BigRat/t/requirer.t) | 1 | ||||
-rw-r--r-- | dist/Math-BigRat/t/trap.t (renamed from cpan/Math-BigRat/t/trap.t) | 11 |
16 files changed, 94 insertions, 102 deletions
@@ -1345,20 +1345,6 @@ cpan/Log-Message/t/01_Log-Message-Config.t Log::Message tests cpan/Log-Message/t/02_Log-Message.t Log::Message tests cpan/Log-Message/t/conf/config_file Log::Message tests cpan/Log-Message/t/conf/LoadMe.pl Log::Message tests -cpan/Math-BigRat/lib/Math/BigRat.pm Math::BigRat -cpan/Math-BigRat/t/big_ap.t Math::BigRat test -cpan/Math-BigRat/t/bigfltpm.inc Math::BigRat test -cpan/Math-BigRat/t/bigfltrt.t Math::BigRat test -cpan/Math-BigRat/t/biglog.t Math::BigRat test -cpan/Math-BigRat/t/bigratpm.inc Math::BigRat test -cpan/Math-BigRat/t/bigratpm.t Math::BigRat test -cpan/Math-BigRat/t/bigrat.t Math::BigRat test -cpan/Math-BigRat/t/bigratup.t test under $Math::BigInt::upgrade -cpan/Math-BigRat/t/bigroot.t Math::BigRat test -cpan/Math-BigRat/t/hang.t Math::BigRat test for bug #34584 - hang in exp() -cpan/Math-BigRat/t/Math/BigRat/Test.pm Math::BigRat test helper -cpan/Math-BigRat/t/requirer.t see if require works properly -cpan/Math-BigRat/t/trap.t see if trap_nan and trap_inf work cpan/Math-Complex/lib/Math/Complex.pm A Complex package cpan/Math-Complex/lib/Math/Trig.pm A simple interface to complex trigonometry cpan/Math-Complex/t/Complex.t See if Math::Complex works @@ -2865,6 +2851,20 @@ dist/Math-BigInt/t/use_lib4.t Test combinations of Math::BigInt and BigFloat dist/Math-BigInt/t/use_mbfw.t use BigFloat w/ with and lib at the same time dist/Math-BigInt/t/use.t Test if use Math::BigInt(); works dist/Math-BigInt/t/with_sub.t Test use Math::BigFloat with => package +dist/Math-BigRat/lib/Math/BigRat.pm Math::BigRat +dist/Math-BigRat/t/big_ap.t Math::BigRat test +dist/Math-BigRat/t/bigfltpm.inc Math::BigRat test +dist/Math-BigRat/t/bigfltrt.t Math::BigRat test +dist/Math-BigRat/t/biglog.t Math::BigRat test +dist/Math-BigRat/t/bigratpm.inc Math::BigRat test +dist/Math-BigRat/t/bigratpm.t Math::BigRat test +dist/Math-BigRat/t/bigrat.t Math::BigRat test +dist/Math-BigRat/t/bigratup.t test under $Math::BigInt::upgrade +dist/Math-BigRat/t/bigroot.t Math::BigRat test +dist/Math-BigRat/t/hang.t Math::BigRat test for bug #34584 - hang in exp() +dist/Math-BigRat/t/Math/BigRat/Test.pm Math::BigRat test helper +dist/Math-BigRat/t/requirer.t see if require works properly +dist/Math-BigRat/t/trap.t see if trap_nan and trap_inf work dist/Module-CoreList/Changes Module::CoreList Changes dist/Module-CoreList/corelist The corelist command-line utility dist/Module-CoreList/identify-dependencies A usage example for Module::CoreList diff --git a/Porting/Maintainers.pl b/Porting/Maintainers.pl index 1c27564e52..1a5bc8aea1 100755 --- a/Porting/Maintainers.pl +++ b/Porting/Maintainers.pl @@ -890,14 +890,14 @@ use File::Glob qw(:case); { 'MAINTAINER' => 'rafl', 'DISTRIBUTION' => 'FLORA/Math-BigRat-0.26.tar.gz', - 'FILES' => q[cpan/Math-BigRat], + 'FILES' => q[dist/Math-BigRat], 'EXCLUDED' => [ qr{^inc/}, qw{ t/pod.t t/pod_cov.t }, ], - 'UPSTREAM' => 'cpan', + 'UPSTREAM' => 'blead', }, 'Math::Complex' => diff --git a/cpan/Math-BigRat/lib/Math/BigRat.pm b/dist/Math-BigRat/lib/Math/BigRat.pm index 030a87ecdb..3508bf94f0 100644 --- a/cpan/Math-BigRat/lib/Math/BigRat.pm +++ b/dist/Math-BigRat/lib/Math/BigRat.pm @@ -29,7 +29,7 @@ $VERSION = eval $VERSION; use overload; # inherit overload from Math::BigFloat BEGIN - { + { *objectify = \&Math::BigInt::objectify; # inherit this from BigInt *AUTOLOAD = \&Math::BigFloat::AUTOLOAD; # can't inherit AUTOLOAD # we inherit these from BigFloat because currently it is not possible @@ -86,14 +86,14 @@ sub _new_from_float { # something like Math::BigRat->new('0.1'); # 1 / 1 => 1/10 - $MBI->_lsft ( $self->{_d}, $f->{_e} ,10); + $MBI->_lsft ( $self->{_d}, $f->{_e} ,10); } else { # something like Math::BigRat->new('10'); # 1 / 1 => 10/1 - $MBI->_lsft ( $self->{_n}, $f->{_e} ,10) unless - $MBI->_is_zero($f->{_e}); + $MBI->_lsft ( $self->{_n}, $f->{_e} ,10) unless + $MBI->_is_zero($f->{_e}); } $self; } @@ -106,7 +106,7 @@ sub new my ($n,$d) = @_; my $self = { }; bless $self,$class; - + # input like (BigInt) or (BigFloat): if ((!defined $d) && (ref $n) && (!$n->isa('Math::BigRat'))) { @@ -197,7 +197,7 @@ sub new local $Math::BigFloat::accuracy = undef; local $Math::BigFloat::precision = undef; - # one of them looks like a float + # one of them looks like a float my $nf = Math::BigFloat->new($n,undef,undef); $self->{sign} = '+'; return $self->bnan() if $nf->is_nan(); @@ -247,7 +247,7 @@ sub new $n = Math::BigInt->new($n,undef,undef) unless ref $n; if ($n->{sign} =~ /^[+-]$/ && $d->{sign} =~ /^[+-]$/) - { + { # both parts are ok as integers (wierd things like ' 1e0' $self->{_n} = $MBI->_copy($n->{value}); $self->{_d} = $MBI->_copy($d->{value}); @@ -380,7 +380,7 @@ sub bsstr my $s = $x->{sign}; $s =~ s/^\+//; # +inf => inf return $s; } - + my $s = ''; $s = $x->{sign} if $x->{sign} ne '+'; # +3 vs 3 $s . $MBI->_str($x->{_n}) . '/' . $MBI->_str($x->{_d}); } @@ -416,7 +416,7 @@ sub bnorm # reduce other numbers my $gcd = $MBI->_copy($x->{_n}); $gcd = $MBI->_gcd($gcd,$x->{_d}); - + if (!$MBI->_is_one($gcd)) { $x->{_n} = $MBI->_div($x->{_n},$gcd); @@ -521,14 +521,14 @@ sub badd return $x->bnan() if ($x->{sign} !~ /^[+-]$/ || $y->{sign} !~ /^[+-]$/); # 1 1 gcd(3,4) = 1 1*3 + 1*4 7 - # - + - = --------- = -- + # - + - = --------- = -- # 4 3 4*3 12 # we do not compute the gcd() here, but simple do: # 5 7 5*3 + 7*4 43 - # - + - = --------- = -- + # - + - = --------- = -- # 4 3 4*3 12 - + # and bnorm() will then take care of the rest # 5 * 3 @@ -563,7 +563,7 @@ sub bsub $x->{sign} =~ tr/+-/-+/ unless $x->{sign} eq '+' && $MBI->_is_zero($x->{_n}); # not -0 $x->badd($y,@r); # does norm and round - $x->{sign} =~ tr/+-/-+/ + $x->{sign} =~ tr/+-/-+/ unless $x->{sign} eq '+' && $MBI->_is_zero($x->{_n}); # not -0 $x; } @@ -571,7 +571,7 @@ sub bsub sub bmul { # multiply two rational numbers - + # set up parameters my ($self,$x,$y,@r) = (ref($_[0]),@_); # objectify is costly, so avoid it @@ -604,7 +604,7 @@ sub bmul # 1 2 1 * 2 2 1 # - * - = ----- = - = - # 4 3 4 * 3 12 6 - + $x->{_n} = $MBI->_mul( $x->{_n}, $y->{_n}); $x->{_d} = $MBI->_mul( $x->{_d}, $y->{_d}); @@ -640,11 +640,11 @@ sub bdiv # 1 1 1 3 # - / - == - * - # 4 3 4 1 - + $x->{_n} = $MBI->_mul( $x->{_n}, $y->{_d}); $x->{_d} = $MBI->_mul( $x->{_d}, $y->{_n}); - # compute new sign + # compute new sign $x->{sign} = $x->{sign} eq $y->{sign} ? '+' : '-'; $x->bnorm()->round(@r); @@ -674,14 +674,14 @@ sub bmod my $u = bless { sign => '+' }, $self; $u->{_n} = $MBI->_mul( $MBI->_copy($x->{_n}), $y->{_d} ); $u->{_d} = $MBI->_mul( $MBI->_copy($x->{_d}), $y->{_n} ); - + # compute floor(u) if (! $MBI->_is_one($u->{_d})) { $u->{_n} = $MBI->_div($u->{_n},$u->{_d}); # 22/7 => 3/1 w/ truncate # no need to set $u->{_d} to 1, since below we set it to $y->{_d} anyway } - + # now compute $y * $u $u->{_d} = $MBI->_copy($y->{_d}); # 1 * $y->{_d}, see floor above $u->{_n} = $MBI->_mul($u->{_n},$y->{_n}); @@ -728,7 +728,7 @@ sub binc { # increment value (add 1) my ($self,$x,@r) = ref($_[0]) ? (ref($_[0]),@_) : objectify(1,@_); - + return $x if $x->{sign} !~ /^[+-]$/; # NaN, inf, -inf if ($x->{sign} eq '-') @@ -827,7 +827,7 @@ sub denominator return Math::BigInt->new($x->{sign}) if $x->{sign} eq 'NaN'; # inf, -inf return Math::BigInt->bone() if $x->{sign} !~ /^[+-]$/; - + Math::BigInt->new($MBI->_str($x->{_d})); } @@ -961,7 +961,7 @@ sub bpow if ($x->{sign} eq '-') { # - * - => +, - * - * - => - - $x->{sign} = '+' if $MBI->_is_even($y->{_n}); + $x->{sign} = '+' if $MBI->_is_even($y->{_n}); } return $x->round(@r); } @@ -977,7 +977,7 @@ sub bpow if ($x->{sign} eq '-') { # - * - => +, - * - * - => - - $x->{sign} = '+' if $MBI->_is_even($y->{_n}); + $x->{sign} = '+' if $MBI->_is_even($y->{_n}); } return $x->round(@r); } @@ -1230,7 +1230,7 @@ sub bmodinv } # $x or $y are NaN or +-inf => NaN - return $x->bnan() + return $x->bnan() if $x->{sign} !~ /^[+-]$/ || $y->{sign} !~ /^[+-]$/; if ($x->is_int() && $y->is_int()) @@ -1276,7 +1276,7 @@ sub bsqrt $x->{_n} = $MBI->_copy( $x->{_n}->{_m} ); # 710/45.1 => 710/451 } - # convert parts to $MBI again + # convert parts to $MBI again $x->{_n} = $MBI->_lsft( $MBI->_copy( $x->{_n}->{_m} ), $x->{_n}->{_e}, 10) if ref($x->{_n}) ne $MBI && ref($x->{_n}) ne 'ARRAY'; $x->{_d} = $MBI->_lsft( $MBI->_copy( $x->{_d}->{_m} ), $x->{_d}->{_e}, 10) @@ -1288,7 +1288,7 @@ sub bsqrt sub blsft { my ($self,$x,$y,$b,@r) = objectify(3,@_); - + $b = 2 unless defined $b; $b = $self->new($b) unless ref ($b); $x->bmul( $b->copy()->bpow($y), @r); @@ -1328,8 +1328,8 @@ sub bfround sub bcmp { - # compare two signed numbers - + # compare two signed numbers + # set up parameters my ($self,$x,$y) = (ref($_[0]),@_); # objectify is costly, so avoid it @@ -1358,7 +1358,7 @@ sub bcmp return 0 if $xz && $yz; # 0 <=> 0 return -1 if $xz && $y->{sign} eq '+'; # 0 <=> +y return 1 if $yz && $x->{sign} eq '+'; # +x <=> 0 - + my $t = $MBI->_mul( $MBI->_copy($x->{_n}), $y->{_d}); my $u = $MBI->_mul( $MBI->_copy($y->{_n}), $x->{_d}); @@ -1370,7 +1370,7 @@ sub bcmp sub bacmp { # compare two numbers (as unsigned) - + # set up parameters my ($self,$x,$y) = (ref($_[0]),@_); # objectify is costly, so avoid it @@ -1400,7 +1400,7 @@ sub numify { # convert 17/8 => float (aka 2.125) my ($self,$x) = ref($_[0]) ? (undef,$_[0]) : objectify(1,@_); - + return $x->bstr() if $x->{sign} !~ /^[+-]$/; # inf, NaN, etc # N/1 => N @@ -1416,7 +1416,7 @@ sub as_number # NaN, inf etc return Math::BigInt->new($x->{sign}) if $x->{sign} !~ /^[+-]$/; - + my $u = Math::BigInt->bzero(); $u->{sign} = $x->{sign}; $u->{value} = $MBI->_div( $MBI->_copy($x->{_n}), $x->{_d}); # 22/7 => 3 @@ -1434,7 +1434,7 @@ sub as_float # NaN, inf etc return Math::BigFloat->new($x->{sign}) if $x->{sign} !~ /^[+-]$/; - + my $u = Math::BigFloat->bzero(); $u->{sign} = $x->{sign}; # n @@ -1571,7 +1571,7 @@ sub import # register us with MBI to get notified of future lib changes Math::BigInt::_register_callback( $self, sub { $MBI = $_[0]; } ); - + # any non :constant stuff is handled by our parent, Exporter (loaded # by Math::BigFloat, even if @_ is empty, to give it a chance $self->SUPER::import(@a); # for subclasses @@ -1593,7 +1593,7 @@ Math::BigRat - Arbitrary big rational numbers my $x = Math::BigRat->new('3/7'); $x += '5/9'; print $x->bstr(),"\n"; - print $x ** 2,"\n"; + print $x ** 2,"\n"; my $y = Math::BigRat->new('inf'); print "$y ", ($y->is_inf ? 'is' : 'is not') , " infinity\n"; @@ -1664,7 +1664,7 @@ Create a new Math::BigRat object. Input can come in various forms: Returns a copy of the numerator (the part above the line) as signed BigInt. =head2 denominator() - + $d = $x->denominator(); Returns a copy of the denominator (the part under the line) as positive BigInt. @@ -1717,21 +1717,21 @@ This method was added in v0.22 of Math::BigRat (April 2008). $x = Math::BigRat->new('13'); print $x->as_hex(),"\n"; # '0xd' -Returns the BigRat as hexadecimal string. Works only for integers. +Returns the BigRat as hexadecimal string. Works only for integers. =head2 as_bin() $x = Math::BigRat->new('13'); print $x->as_bin(),"\n"; # '0x1101' -Returns the BigRat as binary string. Works only for integers. +Returns the BigRat as binary string. Works only for integers. =head2 as_oct() $x = Math::BigRat->new('13'); print $x->as_oct(),"\n"; # '015' -Returns the BigRat as octal string. Works only for integers. +Returns the BigRat as octal string. Works only for integers. =head2 from_hex()/from_bin()/from_oct() @@ -1849,19 +1849,19 @@ Set $x to the next bigger integer value (e.g. truncate the number to integer and then increment it by one). =head2 bfloor() - + $x->bfloor(); Truncate $x to an integer value. =head2 bsqrt() - + $x->bsqrt(); Calculate the square root of $x. =head2 broot() - + $x->broot($n); Calculate the N'th root of $x. diff --git a/cpan/Math-BigRat/t/Math/BigRat/Test.pm b/dist/Math-BigRat/t/Math/BigRat/Test.pm index 630a84359a..74f9f9d004 100644 --- a/cpan/Math-BigRat/t/Math/BigRat/Test.pm +++ b/dist/Math-BigRat/t/Math/BigRat/Test.pm @@ -6,7 +6,7 @@ use strict; use Exporter; use Math::BigRat; use Math::BigFloat; -use vars qw($VERSION @ISA +use vars qw($VERSION @ISA $accuracy $precision $round_mode $div_scale); @ISA = qw(Math::BigRat Exporter); @@ -36,7 +36,7 @@ my $class = 'Math::BigRat::Test'; # return $self; #} -BEGIN +BEGIN { *fstr = \&bstr; *fsstr = \&bsstr; @@ -88,7 +88,7 @@ sub bstr my $s = ''; $s = $x->{sign} if $x->{sign} ne '+'; # +3 vs 3 # print " bstr \$x ", $accuracy || $x->{_a} || 'notset', " ", $precision || $x->{_p} || 'notset', "\n"; - return $s.$x->{_n} if $x->{_d}->is_one(); + return $s.$x->{_n} if $x->{_d}->is_one(); my $output = Math::BigFloat->new($x->{_n})->bdiv($x->{_d}); local $Math::BigFloat::accuracy = $accuracy || $x->{_a}; local $Math::BigFloat::precision = $precision || $x->{_p}; diff --git a/cpan/Math-BigRat/t/big_ap.t b/dist/Math-BigRat/t/big_ap.t index 39a2f7185b..1b45eddfe7 100644 --- a/cpan/Math-BigRat/t/big_ap.t +++ b/dist/Math-BigRat/t/big_ap.t @@ -92,4 +92,3 @@ is ($z,$proper2); $x = $proper->copy()->binc(); is ($x,$proper_inc); $x = $proper->copy()->bdec(); is ($x,$proper_dec); - diff --git a/cpan/Math-BigRat/t/bigfltpm.inc b/dist/Math-BigRat/t/bigfltpm.inc index c51741bd42..fcc09c75be 100644 --- a/cpan/Math-BigRat/t/bigfltpm.inc +++ b/dist/Math-BigRat/t/bigfltpm.inc @@ -39,7 +39,7 @@ while (<DATA>) } elsif ($f eq "finf") { $try .= "\$x->finf('$args[1]');"; } elsif ($f eq "is_inf") { - $try .= "\$x->is_inf('$args[1]');"; + $try .= "\$x->is_inf('$args[1]');"; } elsif ($f eq "fone") { $try .= "\$x->bone('$args[1]');"; } elsif ($f eq "fstr") { @@ -60,7 +60,7 @@ while (<DATA>) # some unary ops (test the fxxx form, since that is done by AUTOLOAD) } elsif ($f =~ /^f(nan|sstr|neg|floor|ceil|abs)$/) { $try .= "\$x->f$1();"; - # some is_xxx test function + # some is_xxx test function } elsif ($f =~ /^is_(zero|one|negative|positive|odd|even|nan|int)$/) { $try .= "\$x->$f();"; } elsif ($f eq "finc") { @@ -89,7 +89,7 @@ while (<DATA>) else { $try .= "\$y = $class->new(\"$args[1]\");"; - + if ($f eq "bgcd") { if (defined $args[2]) @@ -174,7 +174,7 @@ while (<DATA>) } } # end while -# check whether $class->new( Math::BigInt->new()) destroys it +# check whether $class->new( Math::BigInt->new()) destroys it # ($y == 12 in this case) $x = Math::BigInt->new(1200); $y = $class->new($x); ok ($y,1200); ok ($x,1200); @@ -191,21 +191,21 @@ ok ($y,1200); ok ($x,1200); my $monster = '1e1234567890123456789012345678901234567890'; # new and exponent -ok ($class->new($monster)->bsstr(), +ok ($class->new($monster)->bsstr(), '1e+1234567890123456789012345678901234567890'); -ok ($class->new($monster)->exponent(), +ok ($class->new($monster)->exponent(), '1234567890123456789012345678901234567890'); # cmp ok ($class->new($monster) > 0,1); -# sub/mul +# sub/mul ok ($class->new($monster)->bsub( $monster),0); ok ($class->new($monster)->bmul(2)->bsstr(), '2e+1234567890123456789012345678901234567890'); # mantissa $monster = '1234567890123456789012345678901234567890e2'; -ok ($class->new($monster)->mantissa(), +ok ($class->new($monster)->mantissa(), '123456789012345678901234567890123456789'); ############################################################################### @@ -228,7 +228,7 @@ ok ($class->finf(),'inf'); ok ($class->finf('+'),'inf'); ok ($class->finf('-'),'-inf'); ok ($class->finf('-inf'),'-inf'); - + $class->accuracy(undef); $class->precision(undef); # reset ############################################################################### @@ -265,7 +265,7 @@ $class->precision(-3); $x = $class->new(12); $x->fsqrt(); ok ($x,'3.464'); { no strict; - $try = + $try = '@args' . " = $class" . "::objectify(2,$class,4,5);".'join(" ",@args);'; $ans = eval $try; ok ($ans,"$class 4 5"); @@ -322,7 +322,7 @@ ok ($x ** $y, 0, 'no warnings and zero result'); #perl -MMath::BigFloat -lwe 'print Math::BigFloat->new(".222222222222222222222222222222222222222222")->bceil()' #Use of uninitialized value in numeric le (<=) at BigFloat.pm line 1851. -$x = $class->new(".222222222222222222222222222222222222222222"); +$x = $class->new(".222222222222222222222222222222222222222222"); ok ($x->bceil(), 1, 'no warnings and one as result'); ############################################################################### diff --git a/cpan/Math-BigRat/t/bigfltrt.t b/dist/Math-BigRat/t/bigfltrt.t index 278980ac57..325e6fa77e 100644 --- a/cpan/Math-BigRat/t/bigfltrt.t +++ b/dist/Math-BigRat/t/bigfltrt.t @@ -7,12 +7,12 @@ BEGIN { unshift @INC, 't'; } -use Math::BigRat::Test lib => 'Calc'; # test via this Subclass +use Math::BigRat::Test lib => 'Calc'; # test via this Subclass use vars qw ($class $try $x $y $f @args $ans $ans1 $ans1_str $setup $CL); $class = "Math::BigRat::Test"; $CL = "Math::BigInt::Calc"; - + pass(); # fails still too many tests diff --git a/cpan/Math-BigRat/t/biglog.t b/dist/Math-BigRat/t/biglog.t index 5c4b96b3d4..42e9ac8d64 100644 --- a/cpan/Math-BigRat/t/biglog.t +++ b/dist/Math-BigRat/t/biglog.t @@ -36,23 +36,23 @@ ok ($cl->new(-2,2)->blog(), 'NaN'); ############################################################################# # test bexp() with cached results -is ($cl->new(1)->bexp(), +is ($cl->new(1)->bexp(), '90933395208605785401971970164779391644753259799242' . '/' . '33452526613163807108170062053440751665152000000000', 'bexp(1)'); -is ($cl->new(2)->bexp(1,40), $cl->new(1)->bexp(1,45)->bpow(2,40), 'bexp(2)'); +is ($cl->new(2)->bexp(1,40), $cl->new(1)->bexp(1,45)->bpow(2,40), 'bexp(2)'); -is ($cl->new("12.5")->bexp(1,61), $cl->new(1)->bexp(1,65)->bpow(12.5,61), 'bexp(12.5)'); +is ($cl->new("12.5")->bexp(1,61), $cl->new(1)->bexp(1,65)->bpow(12.5,61), 'bexp(12.5)'); ############################################################################# # test bexp() with big values (non-cached) -is ($cl->new(1)->bexp(1,100)->as_float(100), +is ($cl->new(1)->bexp(1,100)->as_float(100), '2.718281828459045235360287471352662497757247093699959574966967627724076630353547594571382178525166427', 'bexp(100)'); -is ($cl->new("12.5")->bexp(1,91), $cl->new(1)->bexp(1,95)->bpow(12.5,91), - 'bexp(12.5) to 91 digits'); +is ($cl->new("12.5")->bexp(1,91), $cl->new(1)->bexp(1,95)->bpow(12.5,91), + 'bexp(12.5) to 91 digits'); ############################################################################# # some integer results @@ -70,4 +70,3 @@ is ($x->copy()->blog($base), 777, 'blog(777**777, 777)'); # all done 1; - diff --git a/cpan/Math-BigRat/t/bigrat.t b/dist/Math-BigRat/t/bigrat.t index 4d1d451489..b900ffa195 100644 --- a/cpan/Math-BigRat/t/bigrat.t +++ b/dist/Math-BigRat/t/bigrat.t @@ -10,7 +10,7 @@ use Math::BigInt; use Math::BigFloat; # shortcuts -my $cr = 'Math::BigRat'; +my $cr = 'Math::BigRat'; my $mbi = 'Math::BigInt'; my $mbf = 'Math::BigFloat'; @@ -49,7 +49,7 @@ foreach my $func (qw/new bnorm/) # input ala '1+1/3' isn't parsed ok yet $x = $cr->$func('1+1/3'); is ($x,'NaN'); - + $x = $cr->$func('1/1.2'); is ($x,'5/6'); $x = $cr->$func('1.3/1.2'); is ($x,'13/12'); $x = $cr->$func('1.2/1'); is ($x,'6/5'); @@ -125,7 +125,7 @@ is ($x + $y, '7/12'); is ($x * $y, '1/12'); is ($x / $y, '3/4'); -$x = $cr->new('7/5'); $x *= '3/2'; +$x = $cr->new('7/5'); $x *= '3/2'; is ($x,'21/10'); $x -= '0.1'; is ($x,'2'); # not 21/10 @@ -191,7 +191,7 @@ $x = $cr->new('1/2'); $z = $x->bpow('3/1'); is ($x,'1/8'); $x = $cr->new('1/3'); $z = $x->bpow('4/1'); is ($x,'1/81'); $x = $cr->new('2/3'); $z = $x->bpow('4/1'); is ($x,'16/81'); -$x = $cr->new('2/3'); $z = $x->bpow('5/3'); +$x = $cr->new('2/3'); $z = $x->bpow('5/3'); is ($x, '31797617848703662994667839220546583581/62500000000000000000000000000000000000'); ############################################################################## @@ -322,4 +322,3 @@ is ($f, '0.66667', 'as_float(2/3,5)'); # done 1; - diff --git a/cpan/Math-BigRat/t/bigratpm.inc b/dist/Math-BigRat/t/bigratpm.inc index 11028569a1..13ec6240d8 100644 --- a/cpan/Math-BigRat/t/bigratpm.inc +++ b/dist/Math-BigRat/t/bigratpm.inc @@ -38,7 +38,7 @@ while (<DATA>) my $a = $args[1] || ''; $try .= "\$x->binf('$a');"; } elsif ($f eq "is_inf") { - $try .= "\$x->is_inf('$args[1]');"; + $try .= "\$x->is_inf('$args[1]');"; } elsif ($f eq "fone") { $try .= "\$x->bone('$args[1]');"; } elsif ($f eq "fstr") { @@ -59,7 +59,7 @@ while (<DATA>) # some unary ops (can't test the fxxx form, since no AUTOLOAD in BigRat) } elsif ($f =~ /^f(nan|sstr|neg|floor|ceil|abs)$/) { $try .= "\$x->b$1();"; - # some is_xxx test function + # some is_xxx test function } elsif ($f =~ /^is_(zero|one|pos|neg|negative|positive|odd|even|nan|int)\z/) { $try .= "\$x->$f();"; } elsif ($f =~ /^(as_number|as_int)\z/){ @@ -150,7 +150,7 @@ while (<DATA>) } } # end while -# check whether $class->new( Math::BigInt->new()) destroys it +# check whether $class->new( Math::BigInt->new()) destroys it # ($y == 12 in this case) $x = Math::BigInt->new(1200); $y = $class->new($x); is ($y,1200); is ($x,1200); diff --git a/cpan/Math-BigRat/t/bigratpm.t b/dist/Math-BigRat/t/bigratpm.t index d6bb22b1cf..d0a499ce4e 100644 --- a/cpan/Math-BigRat/t/bigratpm.t +++ b/dist/Math-BigRat/t/bigratpm.t @@ -8,5 +8,5 @@ use Math::BigRat lib => 'Calc'; use vars qw ($class $try $x $y $f @args $ans $ans1 $ans1_str $setup $CL); $class = "Math::BigRat"; $CL = "Math::BigInt::Calc"; - + require 't/bigratpm.inc'; # all tests here for sharing diff --git a/cpan/Math-BigRat/t/bigratup.t b/dist/Math-BigRat/t/bigratup.t index e963da3afc..a00c655649 100644 --- a/cpan/Math-BigRat/t/bigratup.t +++ b/dist/Math-BigRat/t/bigratup.t @@ -29,4 +29,3 @@ $x = $rat->new('1/3'); is ($x->bsqrt(), # all tests successfull 1; - diff --git a/cpan/Math-BigRat/t/bigroot.t b/dist/Math-BigRat/t/bigroot.t index 26bcacc5cb..24599482e1 100644 --- a/cpan/Math-BigRat/t/bigroot.t +++ b/dist/Math-BigRat/t/bigroot.t @@ -17,7 +17,7 @@ use Math::BigInt; my $cl = "Math::BigFloat"; my $c = "Math::BigInt"; -# 2 ** 240 = +# 2 ** 240 = # 1766847064778384329583297500742918515827483896875618958121606201292619776 test_broot ('2','240', 8, undef, '1073741824'); @@ -39,4 +39,3 @@ sub test_broot $result =~ s/\..*//; is ($c->new($x)->bpow($n)->broot($y,$scale),$result, "Try: $c $x->bpow($n)->broot($y,$s) == $result"); } - diff --git a/cpan/Math-BigRat/t/hang.t b/dist/Math-BigRat/t/hang.t index cf4d65c678..b2b94a0011 100644 --- a/cpan/Math-BigRat/t/hang.t +++ b/dist/Math-BigRat/t/hang.t @@ -16,4 +16,3 @@ is ("$result", "9535900335500879457687887524133067574481/57838159214452708157836 # done 1; - diff --git a/cpan/Math-BigRat/t/requirer.t b/dist/Math-BigRat/t/requirer.t index 488ed1ecba..06ce1f4faa 100644 --- a/cpan/Math-BigRat/t/requirer.t +++ b/dist/Math-BigRat/t/requirer.t @@ -12,4 +12,3 @@ require Math::BigRat; $x = Math::BigRat->new(1); ++$x; is ($x, 2, '$x got successfully modified'); # all tests done - diff --git a/cpan/Math-BigRat/t/trap.t b/dist/Math-BigRat/t/trap.t index cd3f442f2d..2811524a18 100644 --- a/cpan/Math-BigRat/t/trap.t +++ b/dist/Math-BigRat/t/trap.t @@ -19,7 +19,7 @@ foreach my $class ($mbi) # can set? $cfg = $class->config( trap_nan => 1 ); is ($cfg->{trap_nan},1); - + # can set via hash ref? $cfg = $class->config( { trap_nan => 1 } ); is ($cfg->{trap_nan},1); @@ -30,23 +30,23 @@ foreach my $class ($mbi) # can reset? $cfg = $class->config( trap_nan => 0 ); is ($cfg->{trap_nan},0); - + # can set? $cfg = $class->config( trap_inf => 1 ); is ($cfg->{trap_inf},1); eval ("\$x = \$class->new('4711'); \$x->binf();"); like ($@, qr/^Tried to set/); is ($x,4711); # after new() never modified - + # +$x/0 => +inf eval ("\$x = \$class->new('4711'); \$x->bdiv(0);"); like ($@, qr/^Tried to set/); is ($x,4711); # after new() never modified - + # -$x/0 => -inf eval ("\$x = \$class->new('-0815'); \$x->bdiv(0);"); like ($@, qr/^Tried to set/); is ($x,-815); # after new() never modified - + $cfg = $class->config( trap_nan => 1 ); # 0/0 => NaN eval ("\$x = \$class->new('0'); \$x->bdiv(0);"); @@ -72,4 +72,3 @@ for my $trap (qw/0.1a +inf inf -inf/) } # all tests done - |