[libmath-prime-util-perl] 59/59: Check main::rand() existance at runtime
Partha P. Mukherjee
ppm-guest at moszumanska.debian.org
Thu May 21 18:45:05 UTC 2015
This is an automated email from the git hooks/post-receive script.
ppm-guest pushed a commit to annotated tag v0.10
in repository libmath-prime-util-perl.
commit 1424210e7d31c8df7c157e23d64aeaee8b0087a9
Author: Dana Jacobsen <dana at acm.org>
Date: Tue Jul 17 00:33:03 2012 -0600
Check main::rand() existance at runtime
---
lib/Math/Prime/Util.pm | 11 ++++++++---
1 file changed, 8 insertions(+), 3 deletions(-)
diff --git a/lib/Math/Prime/Util.pm b/lib/Math/Prime/Util.pm
index 25315dc..abfd7a5 100644
--- a/lib/Math/Prime/Util.pm
+++ b/lib/Math/Prime/Util.pm
@@ -316,8 +316,9 @@ sub primes {
{
# Note: I was using rand($range), but Math::Random::MT ignores the argument
# instead of following its documentation.
- my $irandf = (defined &::rand) ? sub { return int(::rand()*shift); }
- : sub { return int(rand()*shift); };
+ my $irandf = sub {
+ return int( (defined &::rand) ? ::rand()*$_[0] : rand()*$_[0] );
+ };
# TODO: Look at RANDBITS if using system rand
my $rand_max_bits = 31;
my $rand_max_val = 1 << $rand_max_bits;
@@ -1186,7 +1187,11 @@ sub LogarithmicIntegral {
return Math::BigFloat->binf('-') if $n == 1;
return Math::BigFloat->new('1.045163780117492784844588889194613136522615578151201575832909144075013205210359530172717405626383356306') if $n == 2;
} else {
- return 0+'-inf' if $n == 1;
+ if ($n == 1) {
+ my $neg_infinity = 0+'-inf';
+ return (-9)**9**9 if $neg_infinity == 0;
+ return $neg_infinity;
+ }
return 1.045163780117492784844588889194613136522615578151 if $n == 2;
}
ExponentialIntegral(log($n));
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-perl/packages/libmath-prime-util-perl.git
More information about the Pkg-perl-cvs-commits
mailing list