develooper Front page | perl.perl5.porters | Postings from January 2011

[perl #81400] [PATCH] Fix bmodinv() part of RT 63237

From:
Father Chrysostomos via RT
Date:
January 2, 2011 14:33
Subject:
[perl #81400] [PATCH] Fix bmodinv() part of RT 63237
Message ID:
rt-3.6.HEAD-5425-1294007576-2.81400-15-0@perl.org
On Tue Dec 28 09:04:23 2010, pjacklam@online.no wrote:
> The following standard definition is used: z is the modular inverse of
> x (mod y) if and only if x*z (mod y) = 1 (mod y).
> 
> - dist/Math-BigInt/lib/Math/BigInt.pm: Fix the code in bmodinv() so it
> can
>   handle negative arguments. The code can be optimized further for
> speed,
>   but correctnes first.
> 
> - dist/Math-BigInt/t/bigintpm.inc: Fix the test case for modinv(-3,
> -5).
>   The output should be -3, since -3 * -3 (mod -5) = -9 (mod -5) = -4,
> and
>   1 (mod -5) = -4.
> 
> - dist/Math-BigRat/t/bigratpm.inc: Fix same test case as above.
>   Math::BigRat::bmodinv() only handles integers, and is essentially
> just a
>   front-end to Math::BigInt::bmodinv().
> ---
>  dist/Math-BigInt/lib/Math/BigInt.pm |   97
> ++++++++++++++++++++++++++---------
>  dist/Math-BigInt/t/bigintpm.inc     |    2 +-
>  dist/Math-BigRat/t/bigratpm.inc     |    2 +-
>  3 files changed, 74 insertions(+), 27 deletions(-)

Thank you. Applied as 487de07.




nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About