[libmath-prime-util-perl] 27/35: Make sure large primorials don't overflow sigma_0
Partha P. Mukherjee
ppm-guest at moszumanska.debian.org
Thu May 21 18:50:04 UTC 2015
This is an automated email from the git hooks/post-receive script.
ppm-guest pushed a commit to annotated tag v0.33
in repository libmath-prime-util-perl.
commit 019534724231c0278817704a9089e8de72086846
Author: Dana Jacobsen <dana at acm.org>
Date: Thu Nov 14 17:03:10 2013 -0800
Make sure large primorials don't overflow sigma_0
---
lib/Math/Prime/Util.pm | 3 +++
1 file changed, 3 insertions(+)
diff --git a/lib/Math/Prime/Util.pm b/lib/Math/Prime/Util.pm
index 544af84..eb1067a 100644
--- a/lib/Math/Prime/Util.pm
+++ b/lib/Math/Prime/Util.pm
@@ -1552,6 +1552,9 @@ sub divisor_sum {
: ($k > 5) ? 1
: $n >= $_ds_overflow[$k];
+ # Given a large enough primorial, even k=0 will overflow.
+ $will_overflow = 1 if $k==0 && ref($n) eq 'Math::BigInt' && $n->length > 123;
+
return _XS_divisor_sum($n, $k) if $n <= $_XS_MAXVAL && !$will_overflow;
if ($will_overflow) {
--
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