Upgrade to prereleases of Math::BigInt 1.70 and
[p5sagit/p5-mst-13.2.git] / lib / Math / BigInt / t / upgrade.inc
index 26b3a65..4799420 100644 (file)
@@ -1,12 +1,12 @@
-#include this file into another for subclass testing
+# include this file into another for subclass testing
 
 # This file is nearly identical to bigintpm.t, except that certain results
 # are _requird_ to be different due to "upgrading" or "promoting" to BigFloat.
 # The reverse is not true, any unmarked results can be either BigInt or
 # BigFloat, depending on how good the internal optimization is (e.g. it
-# is usually desirable to have 2 ** 2 return an BigInt, not an BigFloat).
+# is usually desirable to have 2 ** 2 return a BigInt, not a BigFloat).
 
-# Results that are required to be BigFloat are marked with an "^" at the end.
+# Results that are required to be BigFloat are marked with C<^> at the end.
 
 # Please note that the testcount goes up by two for each extra result marked
 # with ^, since then we test whether it has the proper class and that it left
@@ -52,7 +52,7 @@ my ($f,$z,$a,$exp,@a,$m,$e,$round_mode,$expected_class);
 
 while (<DATA>) 
   {
-  chop;
+  chomp;
   next if /^#/;        # skip comments
   if (s/^&//) 
     {
@@ -117,6 +117,8 @@ while (<DATA>)
       $try .= '$x <=> $y;';
       } elsif ($f eq "bround") {
       $try .= "$round_mode; \$x->bround(\$y);";
+      } elsif ($f eq "broot") {
+      $try .= "\$x->broot(\$y);";
       } elsif ($f eq "bacmp"){
       $try .= '$x->bacmp($y);';
       } elsif ($f eq "badd"){
@@ -212,6 +214,12 @@ while (<DATA>)
   } # endwhile data tests
 close DATA;
 
+my $warn = ''; $SIG{__WARN__} = sub { $warn = shift; };
+
+# these should not warn
+$warn = ''; eval "\$z = 3.17 <= \$y"; ok ($z, 1); ok ($warn, '');
+$warn = ''; eval "\$z = \$y >= 3.17"; ok ($z, 1); ok ($warn, '');
+
 # all tests done
 
 1;
@@ -725,9 +733,9 @@ baddNaN:+inf:NaN
 -123456789:987654321:864197532
 -123456789:-987654321:-1111111110
 +123456789:-987654321:-864197532
-#2:2.5:4.5^
-#-123:-1.5:-124.5^
-#-1.2:1:-0.2^
+2:2.5:4.5^
+-123:-1.5:-124.5^
+-1.2:1:-0.2^
 &bsub
 abc:abc:NaN
 abc:+0:NaN
@@ -1237,7 +1245,7 @@ abc:NaN,NaN
 &bfac
 -1:NaN
 NaNfac:NaN
-+inf:NaN
++inf:inf
 -inf:NaN
 0:1
 1:1
@@ -1255,8 +1263,8 @@ abc:12:NaN
 0:0:1
 0:1:0
 0:2:0
-0:-1:NaN
-0:-2:NaN
+0:-1:inf
+0:-2:inf
 1:0:1
 1:1:1
 1:2:1
@@ -1289,6 +1297,14 @@ abc:12:NaN
 -1:-2:1
 -1:-3:-1
 -1:-4:1
+-2:2:4
+-2:3:-8
+-2:4:16
+-2:5:-32
+-3:2:9
+-3:3:-27
+-3:4:81
+-3:5:-243
 10:2:100
 10:3:1000
 10:4:10000
@@ -1309,6 +1325,11 @@ abc:12:NaN
 10000000000000000:17
 -123:3
 215960156869840440586892398248:30
+# broot always upgrades
+&broot
+144:2:12^
+123:2:11.09053650640941716205160010260993291846^
+# bsqrt always upgrades
 &bsqrt
 145:12.04159457879229548012824103037860805243^
 144:12^
@@ -1333,7 +1354,8 @@ abc:12:NaN
 -2:NaN
 -123:NaN
 Nan:NaN
-+inf:NaN
++inf:inf
+-inf:NaN
 &bround
 $round_mode('trunc')
 0:12:0