$NetBSD: patch-dm,v 1.1 2010/09/23 21:47:48 sno Exp $

Update Math::BigInt to 1.95

--- cpan/Math-BigInt/lib/Math/BigInt/CalcEmu.pm.orig	2010-09-05 15:14:32.000000000 +0000
+++ cpan/Math-BigInt/lib/Math/BigInt/CalcEmu.pm
@@ -5,7 +5,7 @@ use strict;
 # use warnings;	# dont use warnings for older Perls
 use vars qw/$VERSION/;
 
-$VERSION = '0.05';
+$VERSION = '0.06';
 
 package Math::BigInt;
 
--- cpan/Math-BigInt/lib/Math/BigInt/Calc.pm.orig	2010-09-05 15:14:32.000000000 +0000
+++ cpan/Math-BigInt/lib/Math/BigInt/Calc.pm
@@ -1,10 +1,10 @@
 package Math::BigInt::Calc;
 
-use 5.006;
+use 5.006002;
 use strict;
 # use warnings;	# dont use warnings for older Perls
 
-our $VERSION = '0.52';
+our $VERSION = '0.54';
 
 # Package to store unsigned big integers in decimal and do math with them
 
@@ -1264,7 +1264,7 @@ sub _is_even
 
 sub _is_odd
   {
-  # return true if arg is even
+  # return true if arg is odd
   (($_[1]->[0] & 1)) <=> 0; 
   }
 
@@ -1536,22 +1536,20 @@ sub _nok
   # ref to array, return ref to array
   my ($c,$n,$k) = @_;
 
-  # ( 7 )    7!          7*6*5 * 4*3*2*1   7 * 6 * 5
-  # ( - ) = --------- =  --------------- = ---------
-  # ( 3 )   3! (7-3)!    3*2*1 * 4*3*2*1   3 * 2 * 1 
+  # ( 7 )       7!       1*2*3*4 * 5*6*7   5 * 6 * 7       6   7
+  # ( - ) = --------- =  --------------- = --------- = 5 * - * -
+  # ( 3 )   (7-3)! 3!    1*2*3*4 * 1*2*3   1 * 2 * 3       2   3
 
-  # compute n - k + 2 (so we start with 5 in the example above)
+  if (!_is_zero($c,$k))
+    {
   my $x = _copy($c,$n);
-
   _sub($c,$n,$k);
-  if (!_is_one($c,$n))
-    {
     _inc($c,$n);
     my $f = _copy($c,$n); _inc($c,$f);		# n = 5, f = 6, d = 2
     my $d = _two($c);
-    while (_acmp($c,$f,$x) <= 0)		# f < n ?
+    while (_acmp($c,$f,$x) <= 0)		# f <= n ?
       {
-      # n = (n * f / d) == 5 * 6 / 2 => n == 3
+      # n = (n * f / d) == 5 * 6 / 2
       $n = _mul($c,$n,$f); $n = _div($c,$n,$d);
       # f = 7, d = 3
       _inc($c,$f); _inc($c,$d);
--- cpan/Math-BigInt/lib/Math/BigInt.pm.orig	2010-09-05 15:14:32.000000000 +0000
+++ cpan/Math-BigInt/lib/Math/BigInt.pm
@@ -16,9 +16,9 @@ package Math::BigInt;
 # underlying lib might change the reference!
 
 my $class = "Math::BigInt";
-use 5.006;
+use 5.006002;
 
-$VERSION = '1.89_01';
+$VERSION = '1.95';
 
 @ISA = qw(Exporter);
 @EXPORT_OK = qw(objectify bgcd blcm); 
@@ -1260,7 +1260,7 @@ sub blog
   # objectify is costly, so avoid it
   if ((!ref($_[0])) || (ref($_[0]) ne ref($_[1])))
     {
-    ($self,$x,$base,@r) = objectify(1,ref($x),@_);
+    ($self,$x,$base,@r) = objectify(2,@_);
     }
 
   return $x if $x->modify('blog');
@@ -1320,18 +1320,17 @@ sub bnok
     }
   else
     {
-    # ( 7 )    7!          7*6*5 * 4*3*2*1   7 * 6 * 5
-    # ( - ) = --------- =  --------------- = ---------
-    # ( 3 )   3! (7-3)!    3*2*1 * 4*3*2*1   3 * 2 * 1 
-
-    # compute n - k + 2 (so we start with 5 in the example above)
-    my $z = $x - $y;
-    if (!$z->is_one())
+    # ( 7 )       7!       1*2*3*4 * 5*6*7   5 * 6 * 7       6   7
+    # ( - ) = --------- =  --------------- = --------- = 5 * - * -
+    # ( 3 )   (7-3)! 3!    1*2*3*4 * 1*2*3   1 * 2 * 3       2   3
+
+    if (!$y->is_zero())
       {
+      my $z = $x - $y;
       $z->binc();
       my $r = $z->copy(); $z->binc();
       my $d = $self->new(2);
-      while ($z->bacmp($x) <= 0)		# f < x ?
+      while ($z->bacmp($x) <= 0)		# f <= x ?
         {
         $r->bmul($z); $r->bdiv($d);
         $z->binc(); $d->binc();
@@ -1375,11 +1374,11 @@ sub bexp
   else { $x = $u; }
   }
 
-sub blcm 
-  { 
+sub blcm
+  {
   # (BINT or num_str, BINT or num_str) return BINT
   # does not modify arguments, but returns new object
-  # Lowest Common Multiplicator
+  # Lowest Common Multiple
 
   my $y = shift; my ($x);
   if (ref($y))
@@ -1498,13 +1497,13 @@ sub is_even
 
 sub is_positive
   {
-  # return true when arg (BINT or num_str) is positive (>= 0)
+  # return true when arg (BINT or num_str) is positive (> 0)
   my ($self,$x) = ref($_[0]) ? (undef,$_[0]) : objectify(1,@_);
 
   return 1 if $x->{sign} eq '+inf';			# +inf is positive
- 
+
   # 0+ is neither positive nor negative
-  ($x->{sign} eq '+' && !$x->is_zero()) ? 1 : 0;	
+  ($x->{sign} eq '+' && !$x->is_zero()) ? 1 : 0;
   }
 
 sub is_negative
@@ -3136,8 +3135,8 @@ Math::BigInt - Arbitrary size integer/fl
   $x->is_one('-');	# if $x is -1
   $x->is_odd();		# if $x is odd
   $x->is_even();	# if $x is even
-  $x->is_pos();		# if $x >= 0
-  $x->is_neg();		# if $x <  0
+  $x->is_pos();		# if $x > 0
+  $x->is_neg();		# if $x < 0
   $x->is_inf($sign);	# if $x is +inf, or -inf (sign is default '+')
   $x->is_int();		# if $x is an integer (not a float)
 
@@ -3212,14 +3211,14 @@ Math::BigInt - Arbitrary size integer/fl
 
   $x->bfloor();		   # return integer less or equal than $x
   $x->bceil();		   # return integer greater or equal than $x
-  
+
   # The following do not modify their arguments:
 
   # greatest common divisor (no OO style)
   my $gcd = Math::BigInt::bgcd(@values);
-  # lowest common multiplicator (no OO style)
-  my $lcm = Math::BigInt::blcm(@values);	
- 
+  # lowest common multiple (no OO style)
+  my $lcm = Math::BigInt::blcm(@values);
+
   $x->length();		   # return number of digits in number
   ($xl,$f) = $x->length(); # length of number and length of fraction part,
 			   # latter is always 0 digits long for BigInts
@@ -3393,15 +3392,15 @@ to the math operation as additional para
         print scalar $x->copy()->bdiv($y, 2);		# print 4300
         print scalar $x->copy()->bdiv($y)->bround(2);	# print 4300
 
-Please see the section about L<ACCURACY AND PRECISION> for further details.
+Please see the section about L<ACCURACY and PRECISION> for further details.
 
 Value must be greater than zero. Pass an undef value to disable it:
 
 	$x->accuracy(undef);
 	Math::BigInt->accuracy(undef);
 
-Returns the current accuracy. For C<$x->accuracy()> it will return either the
-local accuracy, or if not defined, the global. This means the return value
+Returns the current accuracy. For C<< $x->accuracy() >> it will return either
+the local accuracy, or if not defined, the global. This means the return value
 represents the accuracy that will be in effect for $x:
 
 	$y = Math::BigInt->new(1234567);	# unrounded
@@ -3443,15 +3442,15 @@ In Math::BigInt, passing a negative numb
 numbers have digits after the dot. In L<Math::BigFloat>, it will round all
 results to P digits after the dot.
 
-Please see the section about L<ACCURACY AND PRECISION> for further details.
+Please see the section about L<ACCURACY and PRECISION> for further details.
 
 Pass an undef value to disable it:
 
 	$x->precision(undef);
 	Math::BigInt->precision(undef);
 
-Returns the current precision. For C<$x->precision()> it will return either the
-local precision of $x, or if not defined, the global. This means the return
+Returns the current precision. For C<< $x->precision() >> it will return either
+the local precision of $x, or if not defined, the global. This means the return
 value represents the prevision that will be in effect for $x:
 
 	$y = Math::BigInt->new(1234567);	# unrounded
@@ -3509,7 +3508,7 @@ See L<Input> for more info on accepted i
 
 =head2 from_bin()
 
-	$x = Math::BigInt->from_oct("0x10011");	# input is binary
+	$x = Math::BigInt->from_bin("0x10011");	# input is binary
 
 =head2 bnan()
 
@@ -3605,7 +3604,7 @@ Returns -1, 0, 1 or undef.
 
 	$x->bacmp($y);
 
-Compares $x with $y while ignoring their. Returns -1, 0, 1 or undef.
+Compares $x with $y while ignoring their sign. Returns -1, 0, 1 or undef.
 
 =head2 sign()
 
@@ -3912,8 +3911,8 @@ does change $x in BigFloat.
 
 =head2 blcm()
 
-	blcm(@values);		# lowest common multiplicator (no OO style)
- 
+	blcm(@values);		# lowest common multiple (no OO style)
+
 head2 length()
 
 	$x->length();
@@ -4654,8 +4653,8 @@ directly.
 
 =item *
 
-The private object hash keys like C<$x->{sign}> may not be changed, but
-additional keys can be added, like C<$x->{_custom}>.
+The private object hash keys like C<< $x->{sign} >> may not be changed, but
+additional keys can be added, like C<< $x->{_custom} >>.
 
 =item *
 
--- cpan/Math-BigInt/lib/Math/BigFloat.pm.orig	2010-09-05 15:14:32.000000000 +0000
+++ cpan/Math-BigInt/lib/Math/BigFloat.pm
@@ -12,8 +12,8 @@ package Math::BigFloat;
 #   _a	: accuracy
 #   _p	: precision
 
-$VERSION = '1.60';
-require 5.006;
+$VERSION = '1.62';
+require 5.006002;
 
 require Exporter;
 @ISA		= qw/Math::BigInt/;
@@ -3905,7 +3905,7 @@ Some routines (C<is_odd()>, C<is_even()>
 C<is_nan()>) return true or false, while others (C<bcmp()>, C<bacmp()>)
 return either undef, <0, 0 or >0 and are suited for sort.
 
-Actual math is done by using the class defined with C<with => Class;> (which
+Actual math is done by using the class defined with C<< with => Class; >> (which
 defaults to BigInts) to represent the mantissa and exponent.
 
 The sign C</^[+-]$/> is stored separately. The string 'NaN' is used to 
