[libmath-prime-util-perl] 13/18: Allow an expression to eval to 0

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


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

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

commit 028e761c1896b09e945de1a306700447561e1d97
Author: Dana Jacobsen <dana at acm.org>
Date:   Wed Dec 19 02:50:52 2012 -0800

    Allow an expression to eval to 0
---
 bin/primes.pl | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/bin/primes.pl b/bin/primes.pl
index b557294..988e0f4 100755
--- a/bin/primes.pl
+++ b/bin/primes.pl
@@ -538,9 +538,10 @@ sub eval_expr {
   $expr =~ s/:1/nth_prime/g;
   $expr =~ s/:2/log/g;
   $expr =~ s/(\d+)/ Math::BigInt->new($1) /g;
-  $expr = eval $expr or die "Cannot eval: $expr\n";
-  $expr = int($expr->bstr) if ref($expr) eq 'Math::BigInt' && $expr <= ~0;
-  return $expr;
+  my $res = eval $expr;
+  die "Cannot eval: $expr\n" if !defined $res;
+  $res = int($res->bstr) if ref($res) eq 'Math::BigInt' && $res <= ~0;
+  $res;
 }
 
 

-- 
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