From: Tels <nospam-abuse@bloodgate.com>
Date: Mon, 21 May 2007 20:17:20 +0000 (+0000)
Subject: Re: Smoke failures with blead@31225 (Linux) [PATCH]
X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=8d8376c624c0059bc9da5e4cfa799a20c1846647;p=p5sagit%2Fp5-mst-13.2.git

Re: Smoke failures with blead@31225 (Linux) [PATCH]
Message-Id: <200705212017.23224@bloodgate.com>

p4raw-id: //depot/perl@31253
---

diff --git a/lib/Math/BigInt/Calc.pm b/lib/Math/BigInt/Calc.pm
index 89f1dde..61bda7d 100644
--- a/lib/Math/BigInt/Calc.pm
+++ b/lib/Math/BigInt/Calc.pm
@@ -45,14 +45,14 @@ sub _base_len
   # block below:
   shift;
 
-  my $b = shift;
+  my ($b, $int) = @_;
   if (defined $b)
     {
     # avoid redefinitions
     undef &_mul;
     undef &_div;
 
-    if ($] > 5.008 && $b > 7)
+    if ($] > 5.008 && $int && $b > 7)
       {
       $BASE_LEN = $b;
       *_mul = \&_mul_use_div_64;
@@ -134,8 +134,25 @@ BEGIN
 #  $e = 5 if $] < 5.006;		# cap, for older Perls
 #  $e = 7 if $e > 7;		# cap, for VMS, OS/390 and other 64 bit systems
 #				# 8 fails inside random testsuite, so take 7
-
-  __PACKAGE__->_base_len($e);	# set and store
+  my $int = 0;
+  if ($e > 7)
+    {
+    use integer;
+    my $e1 = 7;
+    $num = 7;
+    do 
+      {
+      $num = ('9' x ++$e1) + 0;
+      $num *= $num + 1;
+      } while ("$num" =~ /9{$e1}0{$e1}/);	# must be a certain pattern
+    $e1--; 					# last test failed, so retract one step
+    if ($e1 > 7)
+      { 
+      $int = 1; $e = $e1; 
+      }
+    }
+ 
+  __PACKAGE__->_base_len($e,$int);	# set and store
 
   use integer;
   # find out how many bits _and, _or and _xor can take (old default = 16)