Merge pull request #275 from duckduckgo/yegg/contain-bignum

Contain bignum
master
Gabriel Weinberg 2013-12-24 05:31:06 -08:00
commit fcf0f9e89f
1 changed files with 52 additions and 49 deletions

View File

@ -1,7 +1,6 @@
package DDG::Goodie::Calculator;
use DDG::Goodie;
use bignum;
zci is_cached => 1;
zci answer_type => "calc";
@ -93,6 +92,9 @@ handle query_nowhitespace => sub {
# 2011.11.09 fix for 21 + 15 x 0 + 5
$tmp_expr =~ s/(?<!\.)(?<![0-9])0([1-9])/$1/;
{
use bignum;
eval {
$tmp_result = eval($tmp_expr);
};
@ -145,6 +147,7 @@ handle query_nowhitespace => sub {
return $results_no_html . $tmp_result, html => $results_html, heading => "Calculator";
}
}
}
return;
};