[libmath-prime-util-perl] 04/25: Next try at consistent type upgrades for nth_prime_upper/lower

Partha P. Mukherjee ppm-guest at moszumanska.debian.org
Thu May 21 18:50:37 UTC 2015


This is an automated email from the git hooks/post-receive script.

ppm-guest pushed a commit to annotated tag v0.35
in repository libmath-prime-util-perl.

commit be8f98dfa7691ed1a2f48767683412c71b344c78
Author: Dana Jacobsen <dana at acm.org>
Date:   Wed Nov 20 21:57:19 2013 -0800

    Next try at consistent type upgrades for nth_prime_upper/lower
---
 lib/Math/Prime/Util.pm | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/lib/Math/Prime/Util.pm b/lib/Math/Prime/Util.pm
index 6f762c2..63ac022 100644
--- a/lib/Math/Prime/Util.pm
+++ b/lib/Math/Prime/Util.pm
@@ -2378,8 +2378,7 @@ sub nth_prime_lower {
 
   return $_primes_small[$n] if $n <= $#_primes_small;
 
-  $n = _upgrade_to_float($n)
-    if ref($n) eq 'Math::BigInt' || $n > $_Config{'maxprimeidx'};
+  $n = _upgrade_to_float($n) if $n > $_Config{'maxprimeidx'} || $n > 2**45;
 
   my $flogn  = log($n);
   my $flog2n = log($flogn);  # Note distinction between log_2(n) and log^2(n)
@@ -2399,8 +2398,7 @@ sub nth_prime_upper {
 
   return $_primes_small[$n] if $n <= $#_primes_small;
 
-  $n = _upgrade_to_float($n)
-    if ref($n) eq 'Math::BigInt' || $n > $_Config{'maxprimeidx'};
+  $n = _upgrade_to_float($n) if $n > $_Config{'maxprimeidx'} || $n > 2**45;
 
   my $flogn  = log($n);
   my $flog2n = log($flogn);  # Note distinction between log_2(n) and log^2(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