<br> Joe,<br><br> Thanks, I added this information to the ticket too. Mike is already taking care of the problem.<br><br> In case you want to follow the progress:<br><br><a href="http://jira.codehaus.org/browse/MVEL-83">http://jira.codehaus.org/browse/MVEL-83</a><br>
<br> []s<br> Edson<br><br><div class="gmail_quote">2008/4/9 Joe White <<a href="mailto:Joe.White@recondotech.com">Joe.White@recondotech.com</a>>:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<div link="blue" vlink="purple" lang="EN-US">
<div>
<p><span style="font-size: 11pt; color: rgb(31, 73, 125);">Another bug that I just came across while working on getting my
parens to work involved not handling scoped numbers properly. Similar to the
previous one, but different in that it ends the expression evaluation
prematurely. See the drl and result below:</span></p>
<p><span style="font-size: 11pt; color: rgb(31, 73, 125);"> </span></p>
<p style=""><b><span style="font-size: 10pt; color: rgb(150, 0, 0);">package</span></b><span style="font-size: 10pt; color: black;"> test;</span><span style="font-size: 10pt;"></span></p>
<p style=""><b><span style="font-size: 10pt; color: rgb(150, 0, 0);">dialect</span></b><span style="font-size: 10pt; color: black;"> </span><span style="font-size: 10pt; color: green;">"mvel"</span><span style="font-size: 10pt;"></span></p>
<p style=""><b><span style="font-size: 10pt; color: rgb(150, 0, 0);">rule</span></b><span style="font-size: 10pt; color: black;"> </span><span style="font-size: 10pt; color: green;">"test 12"</span><span style="font-size: 10pt;"></span></p>
<p style=""><span style="font-size: 10pt; color: black;"> </span><b><span style="font-size: 10pt; color: rgb(150, 0, 0);">when</span></b><span style="font-size: 10pt;"></span></p>
<p style=""><span style="font-size: 10pt;"> </span></p>
<p style=""><span style="font-size: 10pt; color: black;"> </span><b><span style="font-size: 10pt; color: rgb(150, 0, 0);">then</span></b><span style="font-size: 10pt;"></span></p>
<p style=""><span style="font-size: 10pt; color: black;"> </span><b><span style="font-size: 10pt; color: rgb(150, 0, 0);">double</span></b><span style="font-size: 10pt; color: black;"> rightVal=(10 +
12);</span><span style="font-size: 10pt;"></span></p>
<p style=""><span style="font-size: 10pt; color: black;"> </span><b><span style="font-size: 10pt; color: rgb(150, 0, 0);">double</span></b><span style="font-size: 10pt; color: black;"> wrongVal=(10) +
(12);</span><span style="font-size: 10pt;"></span></p>
<p style=""><span style="font-size: 10pt; color: black;"> </span><b><span style="font-size: 10pt; color: rgb(150, 0, 0);">double</span></b><span style="font-size: 10pt; color: black;"> wrongValTwo =
((10)+12)</span><span style="font-size: 10pt;"></span></p><div class="Ih2E3d">
<p style=""><span style="font-size: 10pt; color: black;"> System.out.println(</span><span style="font-size: 10pt; color: green;">"Right
"</span><span style="font-size: 10pt; color: black;">+rightVal);</span><span style="font-size: 10pt;"></span></p>
<p style=""><span style="font-size: 10pt; color: black;"> System.out.println(</span><span style="font-size: 10pt; color: green;">"Wrong
"</span><span style="font-size: 10pt; color: black;">+wrongVal);</span><span style="font-size: 10pt;"></span></p>
</div><p style=""><span style="font-size: 10pt; color: black;"> System.out.println(</span><span style="font-size: 10pt; color: green;">"WrongTwo
"</span><span style="font-size: 10pt; color: black;">+wrongValTwo);</span><span style="font-size: 10pt;"></span></p>
<p><b><span style="font-size: 10pt; color: rgb(150, 0, 0);">End</span></b></p>
<p><b><span style="font-size: 10pt; color: rgb(150, 0, 0);"> </span></b></p>
<p><b><span style="font-size: 10pt; color: rgb(150, 0, 0);">Results in:</span></b></p>
<p style=""><span style="font-size: 10pt; color: black;">Right 22.0</span><span style="font-size: 10pt;"></span></p>
<p style=""><span style="font-size: 10pt; color: black;">Wrong 10.0</span><span style="font-size: 10pt;"></span></p>
<p><span style="font-size: 10pt; color: black;">WrongTwo 10.0</span></p>
<p><span style="font-size: 10pt; color: black;"> </span></p>
<p><span style="font-size: 10pt; color: black;">Thanks,</span></p>
<p><span style="font-size: 10pt; color: black;">Joe</span><span style="font-size: 11pt; color: rgb(31, 73, 125);"></span></p>
<p><span style="font-size: 11pt; color: rgb(31, 73, 125);"> </span></p>
<div style="border-style: solid none none; border-color: rgb(181, 196, 223) -moz-use-text-color -moz-use-text-color; border-width: 1pt medium medium; padding: 3pt 0in 0in;">
<p><b><span style="font-size: 10pt;">From:</span></b><span style="font-size: 10pt;">
<a href="mailto:rules-users-bounces@lists.jboss.org" target="_blank">rules-users-bounces@lists.jboss.org</a>
[mailto:<a href="mailto:rules-users-bounces@lists.jboss.org" target="_blank">rules-users-bounces@lists.jboss.org</a>] <b>On Behalf Of </b>Edson Tirelli<br>
<b>Sent:</b> Wednesday, April 09, 2008 12:39 PM<br>
<b>To:</b> Rules Users List<br>
<b>Subject:</b> Re: [rules-users] Order of operations</span></p>
</div><div><div></div><div class="Wj3C7c">
<p> </p>
<p style="margin-bottom: 12pt;"><br>
Hi Joe,<br>
<br>
It seems someone skipped the elementary math lessons at school...
:(<br>
<br>
Will open a JIRA for that.<br>
<br>
[]s<br>
Edson</p>
<div>
<p>2008/4/9 Joe White <<a href="mailto:Joe.White@recondotech.com" target="_blank">Joe.White@recondotech.com</a>>:</p>
<div>
<div>
<p>I have a question regarding order of operations in the consequence of a rule
when using the mvel dialect. When executed the Drl below provides <span style="font-size: 10pt; color: black;">Right =30.0</span><span style="font-size: 10pt;"> and <span style="color: black;">Wrong =140.0. The only difference is the
parens around the multiplying expressions, which shouldn't be necessary given
order of operations. Is this a problem with the drools/mvel interaction or is
it completely an issue with mvel? </span></span></p>
<p><span style="font-size: 10pt; color: black;"> </span></p>
<p><span style="font-size: 10pt; color: black;">Is the general expectation that
all expressions must be completely scoped by parens when using mvel? </span></p>
<p> </p>
<p><b><span style="font-size: 10pt; color: rgb(150, 0, 0);">package</span></b><span style="font-size: 10pt; color: black;"> test;</span></p>
<p><b><span style="font-size: 10pt; color: rgb(150, 0, 0);">dialect</span></b><span style="font-size: 10pt; color: black;"> </span><span style="font-size: 10pt; color: green;">"mvel"</span></p>
<p><b><span style="font-size: 10pt; color: rgb(150, 0, 0);">rule</span></b><span style="font-size: 10pt; color: black;"> </span><span style="font-size: 10pt; color: green;">"test 11"</span></p>
<p><span style="font-size: 10pt; color: black;"> </span><b><span style="font-size: 10pt; color: rgb(150, 0, 0);">when</span></b></p>
<p><span style="font-size: 10pt;"> </span></p>
<p><span style="font-size: 10pt; color: black;"> </span><b><span style="font-size: 10pt; color: rgb(150, 0, 0);">then</span></b></p>
<p><span style="font-size: 10pt; color: black;">
</span><b><span style="font-size: 10pt; color: rgb(150, 0, 0);">double</span></b><span style="font-size: 10pt; color: black;"> rightVal=((10-5)*2) + (5*(8-4));</span></p>
<p><span style="font-size: 10pt; color: black;">
</span><b><span style="font-size: 10pt; color: rgb(150, 0, 0);">double</span></b><span style="font-size: 10pt; color: black;"> wrongVal=(10-5)*2 + 5*(8-4);</span></p>
<p><span style="font-size: 10pt;"> </span></p>
<p><span style="font-size: 10pt; color: black;">
System.out.println(</span><span style="font-size: 10pt; color: green;">"Right
="</span><span style="font-size: 10pt; color: black;">+rightVal);</span></p>
<p><span style="font-size: 10pt; color: black;">
System.out.println(</span><span style="font-size: 10pt; color: green;">"Wrong
="</span><span style="font-size: 10pt; color: black;">+wrongVal);</span></p>
<p><b><span style="font-size: 10pt; color: rgb(150, 0, 0);">End</span></b></p>
<p><b><span style="font-size: 10pt; color: rgb(150, 0, 0);"> </span></b></p>
<p><b><span style="font-size: 10pt; color: rgb(150, 0, 0);">After execution:</span></b></p>
<p><span style="font-size: 10pt; color: black;">Right =30.0</span><span style="font-size: 10pt;"> </span></p>
<p><span style="font-size: 10pt; color: black;">Wrong =140.0</span></p>
<p><span style="font-size: 10pt; color: black;"> </span></p>
<p><span style="font-size: 10pt; color: black;"> </span></p>
<p><span style="font-size: 10pt; color: black;">Thank you for all of your help.
We are using drools <a href="http://4.0.4." target="_blank">4.0.4.</a></span></p>
<p><span style="font-size: 10pt; color: black;"> </span></p>
<p><span style="font-size: 10pt; color: black;">Joe</span></p>
<p><span style="font-size: 10pt; color: black;"> </span></p>
<p><span style="font-size: 10pt; color: black;">Also, I haven't figured out how
it arrives at 140. The following format also produces 140, which seems a little
more strange.</span></p>
<p><span style="font-size: 10pt;"> <b>double</b>
wrongVal=10-5*2 + 5*8-4;</span></p>
<p><span style="font-size: 10pt;"> </span></p>
<p><span style="font-size: 10pt;"> </span></p>
<p> </p>
</div>
</div>
<p style="margin-bottom: 12pt;"><br>
_______________________________________________<br>
rules-users mailing list<br>
<a href="mailto:rules-users@lists.jboss.org" target="_blank">rules-users@lists.jboss.org</a><br>
<a href="https://lists.jboss.org/mailman/listinfo/rules-users" target="_blank">https://lists.jboss.org/mailman/listinfo/rules-users</a></p>
</div>
<p><br>
<br clear="all">
<br>
-- <br>
Edson Tirelli<br>
JBoss Drools Core Development<br>
Office: +55 11 3529-6000<br>
Mobile: +55 11 9287-5646<br>
JBoss, a division of Red Hat @ <a href="http://www.jboss.com" target="_blank">www.jboss.com</a>
</p>
</div></div></div>
</div>
<br>_______________________________________________<br>
rules-users mailing list<br>
<a href="mailto:rules-users@lists.jboss.org">rules-users@lists.jboss.org</a><br>
<a href="https://lists.jboss.org/mailman/listinfo/rules-users" target="_blank">https://lists.jboss.org/mailman/listinfo/rules-users</a><br>
<br></blockquote></div><br><br clear="all"><br>-- <br> Edson Tirelli<br> JBoss Drools Core Development<br> Office: +55 11 3529-6000<br> Mobile: +55 11 9287-5646<br> JBoss, a division of Red Hat @ <a href="http://www.jboss.com">www.jboss.com</a>