Fix the library method in lib/Math/BigInt/Calc.pm so that it
corresponds to the fact that a^b (mod 1) = 0 for all a and b.
- lib/Math/BigInt/Calc.pm: fix mentioned bug
- t/bigintpm.inc: add one more test case
- t/bare_mbi.t: increment test counter
- t/bigintpm.t: increment test counter
- t/sub_mbi.t: increment test counter
# modulus of power ($x ** $y) % $z
my ($c,$num,$exp,$mod) = @_;
- # in the trivial case,
+ # a^b (mod 1) = 0 for all a and b
if (_is_one($c,$mod))
{
- splice @$num,0,1; $num->[0] = 0;
- return $num;
+ @$num = 0;
+ return $num;
}
# 0^a (mod m) = 0 if m != 0, a != 0
#!/usr/bin/perl -w
use strict;
-use Test::More tests => 3283;
+use Test::More tests => 3285;
BEGIN { unshift @INC, 't'; }
0:3:5:0
8:7:5032:3840
8:-1:5033:4404
+1e50:1:1:0
98436739867439843769485798542749827593285729587325:43698764986460981048259837659386739857456983759328457:6943857329857295827698367:3104744730915914415259518
# bmodpow Error cases
8:8:-5:NaN
#!/usr/bin/perl -w
use strict;
-use Test::More tests => 3283 + 6;
+use Test::More tests => 3285 + 6;
use Math::BigInt lib => 'Calc';
#!/usr/bin/perl -w
use strict;
-use Test::More tests => 3283
+use Test::More tests => 3285
+ 5; # +5 own tests
BEGIN { unshift @INC, 't'; }