Subject: | MEE fails to evaluate expressions evaluated by Perl |
Date: | Wed, 18 Jul 2018 16:57:48 -0400 |
To: | bug-Math-Expression-Evaluator [...] rt.cpan.org |
From: | Anatomist NoElectrons <anatomist.noelectrons [...] gmail.com> |
Hi,
The following code shows an expression where MEE fails while Perl works
fine. I looked at the MEE code but could not figure out quickly why it is
failing.
use Math::Expression::Evaluator;
my $mathExpEval = Math::Expression::Evaluator->new();
my $expr = "(((sin((abs(-5) * 1.7 * (5 + (2 * 100))) % 5) + -7) * 1 /
(20 + 5 + -(4 * abs(-1)))) + (90 * 20) + -100 + (2 ** 2 + 90 ** 2 + (2 * 2
* 90)))";
my $perlRes = eval($expr);
print STDERR "PERL EVAL: " . $perlRes . "\n";
$mathExpEval->parse($expr);
my $ast = $mathExpEval->{'ast'};
print STDERR "AST: " . Dumper($ast);
my $meeRes = $mathExpEval->val();
print STDERR "RES " . Dumper($meeRes);
-Bhaskar