Subject: | _modpow(x, y, z) returns 1, not 0, when x = 0 and y > 0 |
Mathematically,
0^a (mod b) = 0, when a and b are positive integers.
The Math::BigInt::Calc library returns 1, not 0. Here is a code snipped
that prints 1, not 0, as it should:
----------------------------------------
use strict;
use warnings;
use Math::BigInt::Calc;
my $CALC = 'Math::BigInt::Calc';
my $x = $CALC -> _new(0);
my $y = $CALC -> _new(5);
my $z = $CALC -> _new(3);
my $ans = $CALC -> _modpow($x, $y, $z); # ($x ** $y) % $z
print $CALC -> _str($ans), "\n";
----------------------------------------