Change 14903 by jhi@alpha on 2002/02/27 21:23:14

        Upgrade to Math::BigInt 1.53.

Affected files ...

.... //depot/perl/lib/Math/BigFloat.pm#35 edit
.... //depot/perl/lib/Math/BigInt.pm#37 edit
.... //depot/perl/lib/Math/BigInt/Calc.pm#15 edit
.... //depot/perl/lib/Math/BigInt/t/bare_mbi.t#4 edit
.... //depot/perl/lib/Math/BigInt/t/bigintpm.inc#6 edit
.... //depot/perl/lib/Math/BigInt/t/bigintpm.t#18 edit
.... //depot/perl/lib/Math/BigInt/t/config.t#3 edit
.... //depot/perl/lib/Math/BigInt/t/mbimbf.inc#3 edit
.... //depot/perl/lib/Math/BigInt/t/mbimbf.t#11 edit
.... //depot/perl/lib/Math/BigInt/t/sub_mbi.t#9 edit
.... //depot/perl/lib/Math/BigInt/t/sub_mif.t#3 edit
.... //depot/perl/lib/Math/BigInt/t/upgrade.t#2 edit

Differences ...

==== //depot/perl/lib/Math/BigFloat.pm#35 (text) ====
Index: perl/lib/Math/BigFloat.pm
--- perl/lib/Math/BigFloat.pm.~1~       Wed Feb 27 14:30:06 2002
+++ perl/lib/Math/BigFloat.pm   Wed Feb 27 14:30:06 2002
@@ -12,7 +12,7 @@
 #   _p: precision
 #   _f: flags, used to signal MBI not to touch our private parts
 
-$VERSION = '1.29';
+$VERSION = '1.30';
 require 5.005;
 use Exporter;
 use Math::BigInt qw/objectify/;
@@ -75,7 +75,7 @@
   my %hand_ups = map { $_ => 1 }  
    qw / is_nan is_inf is_negative is_positive
         accuracy precision div_scale round_mode fneg fabs babs fnot
-        objectify
+        objectify upgrade downgrade
        bone binf bnan bzero
       /;
 
@@ -113,6 +113,8 @@
   # handle '+inf', '-inf' first
   if ($wanted =~ /^[+-]?inf$/)
     {
+    return $downgrade->new($wanted) if $downgrade;
+
     $self->{_e} = Math::BigInt->bzero();
     $self->{_m} = Math::BigInt->bzero();
     $self->{sign} = $wanted;
@@ -124,6 +126,9 @@
   if (!ref $mis)
     {
     die "$wanted is not a number initialized to $class" if !$NaNOK;
+    
+    return $downgrade->bnan() if $downgrade;
+    
     $self->{_e} = Math::BigInt->bzero();
     $self->{_m} = Math::BigInt->bzero();
     $self->{sign} = $nan;
@@ -138,6 +143,19 @@
     $self->{_e} -= CORE::length($$mfv) if CORE::length($$mfv) != 0;            
     $self->{sign} = $$mis;
     }
+  # if downgrade, inf, NaN or integers go down
+
+  if ($downgrade && $self->{_e}->{sign} eq '+')
+    {
+#   print "downgrading $$miv$$mfv"."E$$es$$ev";
+    if ($self->{_e}->is_zero())
+      {
+      $self->{_m}->{sign} = $$mis;             # negative if wanted
+      return $downgrade->new($self->{_m});
+      }
+    return $downgrade->new("$$mis$$miv$$mfv"."E$$es$$ev");
+    }
+
   # print "mbf new $self->{sign} $self->{_m} e $self->{_e}\n";
   $self->bnorm()->round(@r);           # first normalize, then round
   }
@@ -196,7 +214,7 @@
  
   my $es = '0'; my $len = 1; my $cad = 0; my $dot = '.';
 
-  my $not_zero = !$x->is_zero();
+  my $not_zero = ! $x->is_zero();
   if ($not_zero)
     {
     $es = $x->{_m}->bstr();
@@ -314,13 +332,14 @@
   # adjust so that exponents are equal
   my $lxm = $x->{_m}->length();
   my $lym = $y->{_m}->length();
-  my $lx = $lxm + $x->{_e};
-  my $ly = $lym + $y->{_e};
-  my $l = $lx - $ly; $l->bneg() if $x->{sign} eq '-';
+  # the numify somewhat limits our length, but makes it much faster
+  my $lx = $lxm + $x->{_e}->numify();
+  my $ly = $lym + $y->{_e}->numify();
+  my $l = $lx - $ly; $l = -$l if $x->{sign} eq '-';
   return $l <=> 0 if $l != 0;
   
   # lengths (corrected by exponent) are equal
-  # so make mantissa euqal length by padding with zero (shift left)
+  # so make mantissa equal length by padding with zero (shift left)
   my $diff = $lxm - $lym;
   my $xm = $x->{_m};           # not yet copy it
   my $ym = $y->{_m};
@@ -332,7 +351,7 @@
     {
     $xm = $x->{_m}->copy()->blsft(-$diff,10);
     }
-  my $rc = $xm->bcmp($ym);
+  my $rc = $xm->bacmp($ym);
   $rc = -$rc if $x->{sign} eq '-';             # -124 < -123
   $rc <=> 0;
   }
@@ -363,8 +382,9 @@
   # adjust so that exponents are equal
   my $lxm = $x->{_m}->length();
   my $lym = $y->{_m}->length();
-  my $lx = $lxm + $x->{_e};
-  my $ly = $lym + $y->{_e};
+  # the numify somewhat limits our length, but makes it much faster
+  my $lx = $lxm + $x->{_e}->numify();
+  my $ly = $lym + $y->{_e}->numify();
   my $l = $lx - $ly;
   return $l <=> 0 if $l != 0;
   
@@ -381,7 +401,7 @@
     {
     $xm = $x->{_m}->copy()->blsft(-$diff,10);
     }
-  $xm->bcmp($ym) <=> 0;
+  $xm->bacmp($ym) <=> 0;
   }
 
 sub badd 
@@ -410,7 +430,7 @@
     }
 
   # speed: no add for 0+y or x+0
-  return $x if $y->is_zero();                          # x+0
+  return $x->bround($a,$p,$r) if $y->is_zero();                # x+0
   if ($x->is_zero())                                   # 0+y
     {
     # make copy, clobbering up x (modify in place!)
@@ -421,18 +441,24 @@
     }
  
   # take lower of the two e's and adapt m1 to it to match m2
-  my $e = $y->{_e}; $e = Math::BigInt::bzero() if !defined $e; # if no BFLOAT
-  $e = $e - $x->{_e};
+  my $e = $y->{_e};
+  $e = Math::BigInt::bzero() if !defined $e;   # if no BFLOAT ?
+  $e = $e->copy();                             # make copy (didn't do it yet)
+  $e->bsub($x->{_e});
   my $add = $y->{_m}->copy();
-  if ($e < 0)
+#  if ($e < 0)                         # < 0
+  if ($e->{sign} eq '-')               # < 0
     {
     my $e1 = $e->copy()->babs();
-    $x->{_m} *= (10 ** $e1);
+    #$x->{_m} *= (10 ** $e1);
+    $x->{_m}->blsft($e1,10);
     $x->{_e} += $e;                    # need the sign of e
     }
-  elsif ($e > 0)
+#  if ($e > 0)                         # > 0
+  elsif (!$e->is_zero())               # > 0
     {
-    $add *= (10 ** $e);
+    #$add *= (10 ** $e);
+    $add->blsft($e,10);
     }
   # else: both e are the same, so just leave them
   $x->{_m}->{sign} = $x->{sign};               # fiddle with signs
@@ -450,12 +476,14 @@
   # subtract second arg from first, modify first
   my ($self,$x,$y,$a,$p,$r) = objectify(2,@_);
 
-  if (!$y->is_zero())          # don't need to do anything if $y is 0
+  if ($y->is_zero())           # still round for not adding zero
     {
-    $y->{sign} =~ tr/+\-/-+/;  # does nothing for NaN
-    $x->badd($y,$a,$p,$r);     # badd does not leave internal zeros
-    $y->{sign} =~ tr/+\-/-+/;  # refix $y (does nothing for NaN)
+    return $x->round($a,$p,$r);
     }
+  
+  $y->{sign} =~ tr/+\-/-+/;    # does nothing for NaN
+  $x->badd($y,$a,$p,$r);       # badd does not leave internal zeros
+  $y->{sign} =~ tr/+\-/-+/;    # refix $y (does nothing for NaN)
   $x;                          # already rounded by badd()
   }
 
@@ -1017,31 +1045,22 @@
 
 sub bfac
   {
-  # (BINT or num_str, BINT or num_str) return BINT
+  # (BFLOAT or num_str, BFLOAT or num_str) return BFLOAT
   # compute factorial numbers
   # modifies first argument
   my ($self,$x,@r) = objectify(1,@_);
 
-  return $x->bnan() if $x->{sign} ne '+';      # inf, NnN, <0 etc => NaN
+  return $x->bnan() 
+    if (($x->{sign} ne '+') ||         # inf, NaN, <0 etc => NaN
+     ($x->{_e}->{sign} ne '+'));       # digits after dot?
+
   return $x->bone(@r) if $x->is_zero() || $x->is_one();                # 0 or 1 => 1
-
-  return $x->bnan() if $x->{_e}->{sign} ne '+';        # digits after dot?
   
   # use BigInt's bfac() for faster calc
   $x->{_m}->blsft($x->{_e},10);                # un-norm m
   $x->{_e}->bzero();                   # norm $x again
   $x->{_m}->bfac();                    # factorial
-  $x->bnorm();
- 
-  #my $n = $x->copy();
-  #$x->bone();
-  #my $f = $self->new(2);
-  #while ($f->bacmp($n) < 0)
-  #  {
-  #  $x->bmul($f); $f->binc();
-  #  }
-  #$x->bmul($f);                                       # last step
-  $x->round(@r);                               # round
+  $x->bnorm()->round(@r);
   }
 
 sub bpow 
@@ -1063,9 +1082,12 @@
     # if $x == -1 and odd/even y => +1/-1  because +-1 ^ (+-1) => +-1
     return $y1->is_odd() ? $x : $x->babs(1);
     }
-  return $x if $x->is_zero() && $y->{sign} eq '+'; # 0**y => 0 (if not y <= 0)
-  # 0 ** -y => 1 / (0 ** y) => / 0! (1 / 0 => +inf)
-  return $x->binf() if $x->is_zero() && $y->{sign} eq '-';
+  if ($x->is_zero())
+    {
+    return $x if $y->{sign} eq '+';    # 0**y => 0 (if not y <= 0)
+    # 0 ** -y => 1 / (0 ** y) => / 0! (1 / 0 => +inf)
+    $x->binf();
+    }
 
   # calculate $x->{_m} ** $y and $x->{_e} * $y separately (faster)
   $y1->babs();
@@ -1079,7 +1101,7 @@
     my $z = $x->copy(); $x->bzero()->binc();
     return $x->bdiv($z,$a,$p,$r);      # round in one go (might ignore y's A!)
     }
-  return $x->round($a,$p,$r,$y);
+  $x->round($a,$p,$r,$y);
   }
 
 ###############################################################################
@@ -1246,9 +1268,14 @@
   # if $x has digits after dot
   if ($x->{_e}->{sign} eq '-')
     {
-    $x->{_m}->brsft(-$x->{_e},10);
-    $x->{_e}->bzero();
-    $x-- if $x->{sign} eq '-';
+    #$x->{_m}->brsft(-$x->{_e},10);
+    #$x->{_e}->bzero();
+    #$x-- if $x->{sign} eq '-';
+
+    $x->{_e}->{sign} = '+';                    # negate e
+    $x->{_m}->brsft($x->{_e},10);              # cut off digits after dot
+    $x->{_e}->bzero();                         # trunc/norm    
+    $x->{_m}->binc() if $x->{sign} eq '-';     # decrement if negative
     }
   $x->round($a,$p,$r);
   }
@@ -1264,9 +1291,14 @@
   # if $x has digits after dot
   if ($x->{_e}->{sign} eq '-')
     {
-    $x->{_m}->brsft(-$x->{_e},10);
-    $x->{_e}->bzero();
-    $x++ if $x->{sign} eq '+';
+    #$x->{_m}->brsft(-$x->{_e},10);
+    #$x->{_e}->bzero();
+    #$x++ if $x->{sign} eq '+';
+
+    $x->{_e}->{sign} = '+';                    # negate e
+    $x->{_m}->brsft($x->{_e},10);              # cut off digits after dot
+    $x->{_e}->bzero();                         # trunc/norm    
+    $x->{_m}->binc() if $x->{sign} eq '+';     # decrement if negative
     }
   $x->round($a,$p,$r);
   }
@@ -1396,7 +1428,14 @@
     elsif ($_[$i] eq 'upgrade')
       {
       # this causes upgrading
-      $upgrade = $_[$i+1];              # or undef to disable
+      $upgrade = $_[$i+1];             # or undef to disable
+      my $s = 2; $s = 1 if @a-$j < 2;   # avoid "can not modify non-existant..."
+      splice @a, $j, $s; $j -= $s;
+      }
+    elsif ($_[$i] eq 'downgrade')
+      {
+      # this causes downgrading
+      $downgrade = $_[$i+1];           # or undef to disable
       my $s = 2; $s = 1 if @a-$j < 2;   # avoid "can not modify non-existant..."
       splice @a, $j, $s; $j -= $s;
       }
@@ -1415,13 +1454,16 @@
 
   return $x if $x->{sign} !~ /^[+-]$/;         # inf, nan etc
 
-  my $zeros = $x->{_m}->_trailing_zeros();     # correct for trailing zeros 
-  if ($zeros != 0)
-    {
-    $x->{_m}->brsft($zeros,10); $x->{_e} += $zeros;
-    }
-  # for something like 0Ey, set y to 1, and -0 => +0
-  $x->{sign} = '+', $x->{_e}->bone() if $x->{_m}->is_zero();
+#  if (!$x->{_m}->is_odd())
+#    {
+    my $zeros = $x->{_m}->_trailing_zeros();   # correct for trailing zeros 
+    if ($zeros != 0)
+      {
+      $x->{_m}->brsft($zeros,10); $x->{_e}->badd($zeros);
+      }
+    # for something like 0Ey, set y to 1, and -0 => +0
+    $x->{sign} = '+', $x->{_e}->bone() if $x->{_m}->is_zero();
+#    }
   # this is to prevent automatically rounding when MBI's globals are set
   $x->{_m}->{_f} = MB_NEVER_ROUND;
   $x->{_e}->{_f} = MB_NEVER_ROUND;
@@ -1439,19 +1481,14 @@
   # return copy as a bigint representation of this BigFloat number
   my ($self,$x) = ref($_[0]) ? (ref($_[0]),$_[0]) : objectify(1,@_);
 
-  my $z;
-  if ($x->{_e}->is_zero())
+  my $z = $x->{_m}->copy();
+  if ($x->{_e}->{sign} eq '-')         # < 0
     {
-    $z = $x->{_m}->copy();
-    $z->{sign} = $x->{sign};
-    return $z;
-    }
-  $z = $x->{_m}->copy();
-  if ($x->{_e} < 0)
-    {
-    $z->brsft(-$x->{_e},10);
+    $x->{_e}->{sign} = '+';            # flip
+    $z->brsft($x->{_e},10);
+    $x->{_e}->{sign} = '-';            # flip back
     } 
-  else
+  elsif (!$x->{_e}->is_zero())         # > 0 
     {
     $z->blsft($x->{_e},10);
     }

==== //depot/perl/lib/Math/BigInt.pm#37 (text) ====
Index: perl/lib/Math/BigInt.pm
--- perl/lib/Math/BigInt.pm.~1~ Wed Feb 27 14:30:06 2002
+++ perl/lib/Math/BigInt.pm     Wed Feb 27 14:30:06 2002
@@ -18,7 +18,7 @@
 my $class = "Math::BigInt";
 require 5.005;
 
-$VERSION = '1.52';
+$VERSION = '1.53';
 use Exporter;
 @ISA =       qw( Exporter );
 @EXPORT_OK = qw( objectify _swap bgcd blcm); 
@@ -161,7 +161,7 @@
 sub upgrade
   {
   no strict 'refs';
-  # make Class->round_mode() work
+  # make Class->upgrade() work
   my $self = shift;
   my $class = ref($self) || $self || __PACKAGE__;
   if (defined $_[0])
@@ -172,6 +172,20 @@
   return ${"${class}::upgrade"};
   }
 
+sub downgrade
+  {
+  no strict 'refs';
+  # make Class->downgrade() work
+  my $self = shift;
+  my $class = ref($self) || $self || __PACKAGE__;
+  if (defined $_[0])
+    {
+    my $u = shift;
+    return ${"${class}::downgrade"} = $u;
+    }
+  return ${"${class}::downgrade"};
+  }
+
 sub div_scale
   {
   no strict 'refs';
@@ -278,7 +292,7 @@
     class => $class,
     };
   foreach (
-   qw/upgrade downgrade precisison accuracy round_mode VERSION div_scale/)
+   qw/upgrade downgrade precision accuracy round_mode VERSION div_scale/)
     {
     $cfg->{lc($_)} = ${"${class}::$_"};
     };
@@ -1079,7 +1093,7 @@
   my ($self,$x) = ref($_[0]) ? (ref($_[0]),$_[0]) : objectify(1,@_);
 
   return 1 if $x->{sign} eq $nan;
-  return 0;
+  0;
   }
 
 sub is_inf
@@ -1097,7 +1111,7 @@
     }
   $sign = quotemeta($sign.'inf');
   return 1 if ($x->{sign} =~ /^$sign$/);
-  return 0;
+  0;
   }
 
 sub is_one
@@ -1314,7 +1328,7 @@
   # modulus (or remainder)
   # (BINT or num_str, BINT or num_str) return BINT
   my ($self,$x,$y,@r) = objectify(2,@_);
- 
+
   return $x if $x->modify('bmod');
   $r[3] = $y;                                  # no push!
   if (($x->{sign} !~ /^[+-]$/) || ($y->{sign} !~ /^[+-]$/) || $y->is_zero())
@@ -1747,8 +1761,7 @@
 
   if ($x->{sign} !~ /^[+-]$/)
     {
-    my $s = $x->{sign}; $s =~ s/^[+]//;
-    return $self->new($s);             # +inf => inf
+    return $self->new($x->{sign});             # keep + or - sign
     }
   my $m = $x->copy();
   # that's inefficient

==== //depot/perl/lib/Math/BigInt/Calc.pm#15 (text) ====
Index: perl/lib/Math/BigInt/Calc.pm
--- perl/lib/Math/BigInt/Calc.pm.~1~    Wed Feb 27 14:30:06 2002
+++ perl/lib/Math/BigInt/Calc.pm        Wed Feb 27 14:30:06 2002
@@ -8,7 +8,7 @@
 use vars qw/@ISA $VERSION/;
 @ISA = qw(Exporter);
 
-$VERSION = '0.23';
+$VERSION = '0.24';
 
 # Package to store unsigned big integers in decimal and do math with them
 
@@ -577,12 +577,24 @@
       return $x; 
       }
     }
-  #if (@$yorg == 1)
-  #  {
-  #  # shortcut, $y is < $BASE
-  #
-  #  }
+  if (@$yorg == 1)
+    {
+    my $rem;
+    $rem = _mod($c,[ @$x ],$yorg) if wantarray;
 
+    # shortcut, $y is < $BASE
+    my $j = scalar @$x; my $r = 0; 
+    my $y = $yorg->[0]; my $b;
+    while ($j-- > 0)
+      {
+      $b = $r * $MBASE + $x->[$j];
+      $x->[$j] = int($b/$y);
+      $r = $b % $y;
+      }
+    pop @$x if @$x > 1 && $x->[-1] == 0;       # splice up a leading zero 
+    return ($x,$rem) if wantarray;
+    return $x;
+    }
 
   my $y = [ @$yorg ];
   if ($LEN_CONVERT != 0)
@@ -705,11 +717,24 @@
       return $x; 
       }
     }
-#  if (@$yorg == 1)
-#    {
-#    # shortcut, $y is < $BASE
-#
-#    }
+  if (@$yorg == 1)
+    {
+    my $rem;
+    $rem = _mod($c,[ @$x ],$yorg) if wantarray;
+
+    # shortcut, $y is < $BASE
+    my $j = scalar @$x; my $r = 0; 
+    my $y = $yorg->[0]; my $b;
+    while ($j-- > 0)
+      {
+      $b = $r * $MBASE + $x->[$j];
+      $x->[$j] = int($b/$y);
+      $r = $b % $y;
+      }
+    pop @$x if @$x > 1 && $x->[-1] == 0;       # splice up a leading zero 
+    return ($x,$rem) if wantarray;
+    return $x;
+    }
 
   my $y = [ @$yorg ];
   if ($LEN_CONVERT != 0)
@@ -1032,12 +1057,12 @@
     }
   elsif ($b == 1)
     {
-    # else need to go trough all elements: O(N),  but loop is a bit simplified
+    # else need to go trough all elements: O(N), but loop is a bit simplified
     my $r = 0;
     foreach (@$x)
       {
-      $r += $_ % $y;
-      $r %= $y;
+      $r = ($r + $_) % $y;             # not much faster, but heh...
+      #$r += $_ % $y; $r %= $y;
       }
     $r = 0 if $r == $y;
     $x->[0] = $r;
@@ -1048,10 +1073,13 @@
     my $r = 0; my $bm = 1;
     foreach (@$x)
       {
-      $r += ($_ % $y) * $bm;
-      $bm *= $b;
-      $bm %= $y;
-      $r %= $y;
+      $r = ($_ * $bm + $r) % $y;
+      $bm = ($bm * $b) % $y;
+
+      #$r += ($_ % $y) * $bm;
+      #$bm *= $b;
+      #$bm %= $y;
+      #$r %= $y;
       }
     $r = 0 if $r == $y;
     $x->[0] = $r;

==== //depot/perl/lib/Math/BigInt/t/bare_mbi.t#4 (text) ====
Index: perl/lib/Math/BigInt/t/bare_mbi.t
--- perl/lib/Math/BigInt/t/bare_mbi.t.~1~       Wed Feb 27 14:30:06 2002
+++ perl/lib/Math/BigInt/t/bare_mbi.t   Wed Feb 27 14:30:06 2002
@@ -26,7 +26,7 @@
     }
   print "# INC = @INC\n";
 
-  plan tests => 2095;
+  plan tests => 2143;
   }
 
 use Math::BigInt lib => 'BareCalc';

==== //depot/perl/lib/Math/BigInt/t/bigintpm.inc#6 (text) ====
Index: perl/lib/Math/BigInt/t/bigintpm.inc
--- perl/lib/Math/BigInt/t/bigintpm.inc.~1~     Wed Feb 27 14:30:06 2002
+++ perl/lib/Math/BigInt/t/bigintpm.inc Wed Feb 27 14:30:06 2002
@@ -1318,6 +1318,32 @@
 100041000510123:3:0
 152403346:12345:4321
 9:5:4
+# test shortcuts in Calc
+# 1ex % 9 is always == 1, 1ex % 113 is != 1 for x = (4..9), 1ex % 10 = 0
+1234:9:1
+123456:9:3
+12345678:9:0
+1234567891:9:1
+123456789123:9:6
+12345678912345:9:6
+1234567891234567:9:1
+123456789123456789:9:0
+1234:10:4
+123456:10:6
+12345678:10:8
+1234567891:10:1
+123456789123:10:3
+12345678912345:10:5
+1234567891234567:10:7
+123456789123456789:10:9
+1234:113:104
+123456:113:60
+12345678:113:89
+1234567891:113:64
+123456789123:113:95
+12345678912345:113:53
+1234567891234567:113:56
+123456789123456789:113:39
 &bgcd
 abc:abc:NaN
 abc:+0:NaN

==== //depot/perl/lib/Math/BigInt/t/bigintpm.t#18 (xtext) ====
Index: perl/lib/Math/BigInt/t/bigintpm.t
--- perl/lib/Math/BigInt/t/bigintpm.t.~1~       Wed Feb 27 14:30:06 2002
+++ perl/lib/Math/BigInt/t/bigintpm.t   Wed Feb 27 14:30:06 2002
@@ -10,7 +10,7 @@
   my $location = $0; $location =~ s/bigintpm.t//;
   unshift @INC, $location; # to locate the testing files
   chdir 't' if -d 't';
-  plan tests => 2095;
+  plan tests => 2143;
   }
 
 use Math::BigInt;

==== //depot/perl/lib/Math/BigInt/t/config.t#3 (text) ====
Index: perl/lib/Math/BigInt/t/config.t
--- perl/lib/Math/BigInt/t/config.t.~1~ Wed Feb 27 14:30:06 2002
+++ perl/lib/Math/BigInt/t/config.t     Wed Feb 27 14:30:06 2002
@@ -22,7 +22,7 @@
 ok (ref($cfg),'HASH');
 
 ok ($cfg->{lib},'Math::BigInt::Calc');
-ok ($cfg->{lib_version},'0.23');
+ok ($cfg->{lib_version},'0.24');
 ok ($cfg->{class},'Math::BigInt');
 ok ($cfg->{upgrade}||'','');
 ok ($cfg->{div_scale},40);

==== //depot/perl/lib/Math/BigInt/t/mbimbf.inc#3 (text) ====
Index: perl/lib/Math/BigInt/t/mbimbf.inc
--- perl/lib/Math/BigInt/t/mbimbf.inc.~1~       Wed Feb 27 14:30:06 2002
+++ perl/lib/Math/BigInt/t/mbimbf.inc   Wed Feb 27 14:30:06 2002
@@ -578,10 +578,16 @@
   print "# Tried: '$try'\n" if !ok ($rc, 'NaN');
   }
 
-# see if $x->bsub(0) really rounds
-$x = $mbi->new(123); $mbi->accuracy(2); $x->bsub(0);
-ok ($x,120);
-$mbi->accuracy(undef);
+# see if $x->bsub(0) and $x->badd(0) really round
+foreach my $class ($mbi,$mbf)
+  {
+  $x = $class->new(123); $class->accuracy(2); $x->bsub(0);
+  ok ($x,120);
+  $class->accuracy(undef);
+  $x = $class->new(123); $class->accuracy(2); $x->badd(0);
+  ok ($x,120);
+  $class->accuracy(undef);
+  }
 
 ###############################################################################
 # test whether shortcuts returning zero/one preserve A and P

==== //depot/perl/lib/Math/BigInt/t/mbimbf.t#11 (text) ====
Index: perl/lib/Math/BigInt/t/mbimbf.t
--- perl/lib/Math/BigInt/t/mbimbf.t.~1~ Wed Feb 27 14:30:06 2002
+++ perl/lib/Math/BigInt/t/mbimbf.t     Wed Feb 27 14:30:06 2002
@@ -31,12 +31,12 @@
     }
   print "# INC = @INC\n";
 
-  plan tests => 435 
+  plan tests => 438 
     + 16;              # own tests
   }
 
-use Math::BigInt 1.50;
-use Math::BigFloat 1.27;
+use Math::BigInt 1.53;
+use Math::BigFloat 1.30;
 
 use vars qw/$mbi $mbf/;
 

==== //depot/perl/lib/Math/BigInt/t/sub_mbi.t#9 (xtext) ====
Index: perl/lib/Math/BigInt/t/sub_mbi.t
--- perl/lib/Math/BigInt/t/sub_mbi.t.~1~        Wed Feb 27 14:30:06 2002
+++ perl/lib/Math/BigInt/t/sub_mbi.t    Wed Feb 27 14:30:06 2002
@@ -26,7 +26,7 @@
     }
   print "# INC = @INC\n";
 
-  plan tests => 2095
+  plan tests => 2143
     + 4;       # +4 own tests
   }
 

==== //depot/perl/lib/Math/BigInt/t/sub_mif.t#3 (text) ====
Index: perl/lib/Math/BigInt/t/sub_mif.t
--- perl/lib/Math/BigInt/t/sub_mif.t.~1~        Wed Feb 27 14:30:06 2002
+++ perl/lib/Math/BigInt/t/sub_mif.t    Wed Feb 27 14:30:06 2002
@@ -28,7 +28,7 @@
     }
   print "# INC = @INC\n";
 
-  plan tests => 435;
+  plan tests => 438;
   }
 
 use Math::BigInt::Subclass;

==== //depot/perl/lib/Math/BigInt/t/upgrade.t#2 (text) ====
Index: perl/lib/Math/BigInt/t/upgrade.t
--- perl/lib/Math/BigInt/t/upgrade.t.~1~        Wed Feb 27 14:30:06 2002
+++ perl/lib/Math/BigInt/t/upgrade.t    Wed Feb 27 14:30:06 2002
@@ -25,7 +25,8 @@
     }
   print "# INC = @INC\n";
 
-  plan tests => 1991;
+   plan tests => 1990
+    + 2;                       # our own tests
   }
 
 use Math::BigInt upgrade => 'Math::BigFloat';
@@ -38,5 +39,6 @@
 $ECL = "Math::BigFloat";
 
 ok (Math::BigInt->upgrade(),'Math::BigFloat');
+ok (Math::BigInt->downgrade()||'','');
 
 require 'upgrade.inc'; # all tests here for sharing
End of Patch.

Reply via email to