This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Re: [PATCH] Math::BigInt v1.87 take 5
[perl5.git] / lib / Math / BigInt / t / bigfltpm.t
index 0c32908..69686d0 100755 (executable)
@@ -27,7 +27,7 @@ BEGIN
   print "# INC = @INC\n";
 
   plan tests => 2064
-       + 3;            # own tests
+       + 5;            # own tests
   }
 
 use Math::BigInt lib => 'Calc';
@@ -41,7 +41,14 @@ ok ($class->config()->{class},$class);
 ok ($class->config()->{with}, $CL);
 
 # bug #17447: Can't call method Math::BigFloat->bsub, not a valid method
-my $c = new Math::BigFloat( '123.3' );
+my $c = Math::BigFloat->new( '123.3' );
 ok ($c->fsub(123) eq '0.3', 1); # calling fsub on a BigFloat works
+
+# Bug until BigInt v1.86, the scale wasn't treated as a scalar:
+$c = Math::BigFloat->new('0.008'); my $d = Math::BigFloat->new(3);
+my $e = $c->bdiv(Math::BigFloat->new(3),$d);
+
+ok ($e,'0.00267'); # '0.008 / 3 => 0.0027');
+ok (ref($e->{_e}->[0]), ''); # 'Not a BigInt');
+
 require 'bigfltpm.inc';        # all tests here for sharing