This is an automated email from the git hooks/post-receive script. ppm-guest pushed a commit to annotated tag v0.23 in repository libmath-prime-util-perl.
commit ed4cf69e725e84917abf9cf0a050411953df9a30 Author: Dana Jacobsen <d...@acm.org> Date: Wed Feb 27 19:37:50 2013 -0800 Fix return value with consec int lcm and MPU::GMP --- MANIFEST | 1 + lib/Math/Prime/Util.pm | 2 +- t/21-conseq-lcm.t | 122 +++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 124 insertions(+), 1 deletion(-) diff --git a/MANIFEST b/MANIFEST index 945ec81..50ca9e0 100644 --- a/MANIFEST +++ b/MANIFEST @@ -73,6 +73,7 @@ t/17-pseudoprime.t t/18-functions.t t/19-moebius.t t/20-primorial.t +t/21-conseq-lcm.t t/22-aks-prime.t t/30-relations.t t/31-threading.t diff --git a/lib/Math/Prime/Util.pm b/lib/Math/Prime/Util.pm index 4c494e9..c87d125 100644 --- a/lib/Math/Prime/Util.pm +++ b/lib/Math/Prime/Util.pm @@ -1054,7 +1054,7 @@ sub consecutive_integer_lcm { if ($_HAVE_GMP && defined &Math::Prime::Util::GMP::consecutive_integer_lcm) { my $clcm = Math::Prime::Util::GMP::consecutive_integer_lcm($n); return int($clcm) unless ref($pn) eq 'Math::BigInt'; - return $pn->copy->badd("$clcm"); + return $pn->bzero->badd("$clcm"); } my @primes = @{primes(2,$n)}; diff --git a/t/21-conseq-lcm.t b/t/21-conseq-lcm.t new file mode 100644 index 0000000..e262583 --- /dev/null +++ b/t/21-conseq-lcm.t @@ -0,0 +1,122 @@ +#!/usr/bin/env perl +use strict; +use warnings; + +use Test::More; +use Math::Prime::Util qw/consecutive_integer_lcm/; + +plan tests => 101 + 1; + +my @lcms = qw/ +1 +1 +2 +6 +12 +60 +60 +420 +840 +2520 +2520 +27720 +27720 +360360 +360360 +360360 +720720 +12252240 +12252240 +232792560 +232792560 +232792560 +232792560 +5354228880 +5354228880 +26771144400 +26771144400 +80313433200 +80313433200 +2329089562800 +2329089562800 +72201776446800 +144403552893600 +144403552893600 +144403552893600 +144403552893600 +144403552893600 +5342931457063200 +5342931457063200 +5342931457063200 +5342931457063200 +219060189739591200 +219060189739591200 +9419588158802421600 +9419588158802421600 +9419588158802421600 +9419588158802421600 +442720643463713815200 +442720643463713815200 +3099044504245996706400 +3099044504245996706400 +3099044504245996706400 +3099044504245996706400 +164249358725037825439200 +164249358725037825439200 +164249358725037825439200 +164249358725037825439200 +164249358725037825439200 +164249358725037825439200 +9690712164777231700912800 +9690712164777231700912800 +591133442051411133755680800 +591133442051411133755680800 +591133442051411133755680800 +1182266884102822267511361600 +1182266884102822267511361600 +1182266884102822267511361600 +79211881234889091923261227200 +79211881234889091923261227200 +79211881234889091923261227200 +79211881234889091923261227200 +5624043567677125526551547131200 +5624043567677125526551547131200 +410555180440430163438262940577600 +410555180440430163438262940577600 +410555180440430163438262940577600 +410555180440430163438262940577600 +410555180440430163438262940577600 +410555180440430163438262940577600 +32433859254793982911622772305630400 +32433859254793982911622772305630400 +97301577764381948734868316916891200 +97301577764381948734868316916891200 +8076030954443701744994070304101969600 +8076030954443701744994070304101969600 +8076030954443701744994070304101969600 +8076030954443701744994070304101969600 +8076030954443701744994070304101969600 +8076030954443701744994070304101969600 +718766754945489455304472257065075294400 +718766754945489455304472257065075294400 +718766754945489455304472257065075294400 +718766754945489455304472257065075294400 +718766754945489455304472257065075294400 +718766754945489455304472257065075294400 +718766754945489455304472257065075294400 +718766754945489455304472257065075294400 +69720375229712477164533808935312303556800 +69720375229712477164533808935312303556800 +69720375229712477164533808935312303556800 +69720375229712477164533808935312303556800 +/; + +foreach my $n (0..100) { + is( consecutive_integer_lcm($n), $lcms[$n], "consecutive_integer_lcm($n)" ); +} + +is( + consecutive_integer_lcm(2000), + '1511177948774443153075363083375728221737363088535793399032279044730004763223472346551221608666689469419939510142709335120301949572213719568288435215680821737862512423331578304504356232116643085003168444786178091011582206721088950535088292661204970317427493760459298902960528055272123153828052193533162707425724019620354648782357037594647968060751310565200798369557704150213185082729821037366586333904113477590005632712260621823459641841673469182252438563487940133554184046958262569116220 [...] + "consecutive_integer_lcm(2000)" + ); -- Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-perl/packages/libmath-prime-util-perl.git _______________________________________________ Pkg-perl-cvs-commits mailing list Pkg-perl-cvs-commits@lists.alioth.debian.org http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/pkg-perl-cvs-commits