<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=us-ascii">
<meta name=Generator content="Microsoft Word 12 (filtered medium)">
<style>
<!--
/* Font Definitions */
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
        {font-family:Tahoma;
        panose-1:2 11 6 4 3 5 4 4 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0in;
        margin-bottom:.0001pt;
        font-size:12.0pt;
        font-family:"Times New Roman","serif";}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:purple;
        text-decoration:underline;}
p
        {mso-style-priority:99;
        mso-margin-top-alt:auto;
        margin-right:0in;
        mso-margin-bottom-alt:auto;
        margin-left:0in;
        font-size:12.0pt;
        font-family:"Times New Roman","serif";}
span.EmailStyle18
        {mso-style-type:personal-reply;
        font-family:"Calibri","sans-serif";
        color:#1F497D;}
.MsoChpDefault
        {mso-style-type:export-only;}
@page Section1
        {size:8.5in 11.0in;
        margin:1.0in 1.0in 1.0in 1.0in;}
div.Section1
        {page:Section1;}
-->
</style>
<!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
</head>
<body lang=EN-US link=blue vlink=purple>
<div class=Section1>
<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'>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:<o:p></o:p></span></p>
<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'><o:p> </o:p></span></p>
<p class=MsoNormal style='text-autospace:none'><b><span style='font-size:10.0pt;
font-family:"Courier New";color:#960000'>package</span></b><span
style='font-size:10.0pt;font-family:"Courier New";color:black'> test;</span><span
style='font-size:10.0pt;font-family:"Courier New"'><o:p></o:p></span></p>
<p class=MsoNormal style='text-autospace:none'><b><span style='font-size:10.0pt;
font-family:"Courier New";color:#960000'>dialect</span></b><span
style='font-size:10.0pt;font-family:"Courier New";color:black'> </span><span
style='font-size:10.0pt;font-family:"Courier New";color:green'>"mvel"</span><span
style='font-size:10.0pt;font-family:"Courier New"'><o:p></o:p></span></p>
<p class=MsoNormal style='text-autospace:none'><b><span style='font-size:10.0pt;
font-family:"Courier New";color:#960000'>rule</span></b><span style='font-size:
10.0pt;font-family:"Courier New";color:black'> </span><span style='font-size:
10.0pt;font-family:"Courier New";color:green'>"test 12"</span><span
style='font-size:10.0pt;font-family:"Courier New"'><o:p></o:p></span></p>
<p class=MsoNormal style='text-autospace:none'><span style='font-size:10.0pt;
font-family:"Courier New";color:black'> </span><b><span style='font-size:
10.0pt;font-family:"Courier New";color:#960000'>when</span></b><span
style='font-size:10.0pt;font-family:"Courier New"'><o:p></o:p></span></p>
<p class=MsoNormal style='text-autospace:none'><span style='font-size:10.0pt;
font-family:"Courier New"'><o:p> </o:p></span></p>
<p class=MsoNormal style='text-autospace:none'><span style='font-size:10.0pt;
font-family:"Courier New";color:black'> </span><b><span style='font-size:
10.0pt;font-family:"Courier New";color:#960000'>then</span></b><span
style='font-size:10.0pt;font-family:"Courier New"'><o:p></o:p></span></p>
<p class=MsoNormal style='text-autospace:none'><span style='font-size:10.0pt;
font-family:"Courier New";color:black'> </span><b><span
style='font-size:10.0pt;font-family:"Courier New";color:#960000'>double</span></b><span
style='font-size:10.0pt;font-family:"Courier New";color:black'> rightVal=(10 +
12);</span><span style='font-size:10.0pt;font-family:"Courier New"'><o:p></o:p></span></p>
<p class=MsoNormal style='text-autospace:none'><span style='font-size:10.0pt;
font-family:"Courier New";color:black'> </span><b><span
style='font-size:10.0pt;font-family:"Courier New";color:#960000'>double</span></b><span
style='font-size:10.0pt;font-family:"Courier New";color:black'> wrongVal=(10) +
(12);</span><span style='font-size:10.0pt;font-family:"Courier New"'><o:p></o:p></span></p>
<p class=MsoNormal style='text-autospace:none'><span style='font-size:10.0pt;
font-family:"Courier New";color:black'> </span><b><span
style='font-size:10.0pt;font-family:"Courier New";color:#960000'>double</span></b><span
style='font-size:10.0pt;font-family:"Courier New";color:black'> wrongValTwo =
((10)+12)</span><span style='font-size:10.0pt;font-family:"Courier New"'><o:p></o:p></span></p>
<p class=MsoNormal style='text-autospace:none'><span style='font-size:10.0pt;
font-family:"Courier New";color:black'> System.out.println(</span><span
style='font-size:10.0pt;font-family:"Courier New";color:green'>"Right
"</span><span style='font-size:10.0pt;font-family:"Courier New";
color:black'>+rightVal);</span><span style='font-size:10.0pt;font-family:"Courier New"'><o:p></o:p></span></p>
<p class=MsoNormal style='text-autospace:none'><span style='font-size:10.0pt;
font-family:"Courier New";color:black'> System.out.println(</span><span
style='font-size:10.0pt;font-family:"Courier New";color:green'>"Wrong
"</span><span style='font-size:10.0pt;font-family:"Courier New";
color:black'>+wrongVal);</span><span style='font-size:10.0pt;font-family:"Courier New"'><o:p></o:p></span></p>
<p class=MsoNormal style='text-autospace:none'><span style='font-size:10.0pt;
font-family:"Courier New";color:black'> System.out.println(</span><span
style='font-size:10.0pt;font-family:"Courier New";color:green'>"WrongTwo
"</span><span style='font-size:10.0pt;font-family:"Courier New";
color:black'>+wrongValTwo);</span><span style='font-size:10.0pt;font-family:
"Courier New"'><o:p></o:p></span></p>
<p class=MsoNormal><b><span style='font-size:10.0pt;font-family:"Courier New";
color:#960000'>End<o:p></o:p></span></b></p>
<p class=MsoNormal><b><span style='font-size:10.0pt;font-family:"Courier New";
color:#960000'><o:p> </o:p></span></b></p>
<p class=MsoNormal><b><span style='font-size:10.0pt;font-family:"Courier New";
color:#960000'>Results in:<o:p></o:p></span></b></p>
<p class=MsoNormal style='text-autospace:none'><span style='font-size:10.0pt;
font-family:"Courier New";color:black'>Right 22.0</span><span style='font-size:
10.0pt;font-family:"Courier New"'><o:p></o:p></span></p>
<p class=MsoNormal style='text-autospace:none'><span style='font-size:10.0pt;
font-family:"Courier New";color:black'>Wrong 10.0</span><span style='font-size:
10.0pt;font-family:"Courier New"'><o:p></o:p></span></p>
<p class=MsoNormal><span style='font-size:10.0pt;font-family:"Courier New";
color:black'>WrongTwo 10.0<o:p></o:p></span></p>
<p class=MsoNormal><span style='font-size:10.0pt;font-family:"Courier New";
color:black'><o:p> </o:p></span></p>
<p class=MsoNormal><span style='font-size:10.0pt;font-family:"Courier New";
color:black'>Thanks,<o:p></o:p></span></p>
<p class=MsoNormal><span style='font-size:10.0pt;font-family:"Courier New";
color:black'>Joe</span><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'><o:p></o:p></span></p>
<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'><o:p> </o:p></span></p>
<div style='border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0in 0in 0in'>
<p class=MsoNormal><b><span style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'>From:</span></b><span
style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'>
rules-users-bounces@lists.jboss.org
[mailto:rules-users-bounces@lists.jboss.org] <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<o:p></o:p></span></p>
</div>
<p class=MsoNormal><o:p> </o:p></p>
<p class=MsoNormal style='margin-bottom:12.0pt'><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<o:p></o:p></p>
<div>
<p class=MsoNormal>2008/4/9 Joe White <<a
href="mailto:Joe.White@recondotech.com">Joe.White@recondotech.com</a>>:<o:p></o:p></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:10.0pt;color:black'>Right =30.0</span><span style='font-size:
10.0pt'> 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><o:p></o:p></p>
<p><span style='font-size:10.0pt;color:black'> </span><o:p></o:p></p>
<p><span style='font-size:10.0pt;color:black'>Is the general expectation that
all expressions must be completely scoped by parens when using mvel? </span><o:p></o:p></p>
<p> <o:p></o:p></p>
<p><b><span style='font-size:10.0pt;color:#960000'>package</span></b><span
style='font-size:10.0pt;color:black'> test;</span><o:p></o:p></p>
<p><b><span style='font-size:10.0pt;color:#960000'>dialect</span></b><span
style='font-size:10.0pt;color:black'> </span><span style='font-size:10.0pt;
color:green'>"mvel"</span><o:p></o:p></p>
<p><b><span style='font-size:10.0pt;color:#960000'>rule</span></b><span
style='font-size:10.0pt;color:black'> </span><span style='font-size:10.0pt;
color:green'>"test 11"</span><o:p></o:p></p>
<p><span style='font-size:10.0pt;color:black'> </span><b><span
style='font-size:10.0pt;color:#960000'>when</span></b><o:p></o:p></p>
<p><span style='font-size:10.0pt'> </span><o:p></o:p></p>
<p><span style='font-size:10.0pt;color:black'> </span><b><span
style='font-size:10.0pt;color:#960000'>then</span></b><o:p></o:p></p>
<p><span style='font-size:10.0pt;color:black'>
</span><b><span style='font-size:10.0pt;color:#960000'>double</span></b><span
style='font-size:10.0pt;color:black'> rightVal=((10-5)*2) + (5*(8-4));</span><o:p></o:p></p>
<p><span style='font-size:10.0pt;color:black'>
</span><b><span style='font-size:10.0pt;color:#960000'>double</span></b><span
style='font-size:10.0pt;color:black'> wrongVal=(10-5)*2 + 5*(8-4);</span><o:p></o:p></p>
<p><span style='font-size:10.0pt'> </span><o:p></o:p></p>
<p><span style='font-size:10.0pt;color:black'>
System.out.println(</span><span style='font-size:10.0pt;color:green'>"Right
="</span><span style='font-size:10.0pt;color:black'>+rightVal);</span><o:p></o:p></p>
<p><span style='font-size:10.0pt;color:black'>
System.out.println(</span><span style='font-size:10.0pt;color:green'>"Wrong
="</span><span style='font-size:10.0pt;color:black'>+wrongVal);</span><o:p></o:p></p>
<p><b><span style='font-size:10.0pt;color:#960000'>End</span></b><o:p></o:p></p>
<p><b><span style='font-size:10.0pt;color:#960000'> </span></b><o:p></o:p></p>
<p><b><span style='font-size:10.0pt;color:#960000'>After execution:</span></b><o:p></o:p></p>
<p><span style='font-size:10.0pt;color:black'>Right =30.0</span><span
style='font-size:10.0pt'> </span><o:p></o:p></p>
<p><span style='font-size:10.0pt;color:black'>Wrong =140.0</span><o:p></o:p></p>
<p><span style='font-size:10.0pt;color:black'> </span><o:p></o:p></p>
<p><span style='font-size:10.0pt;color:black'> </span><o:p></o:p></p>
<p><span style='font-size:10.0pt;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><o:p></o:p></p>
<p><span style='font-size:10.0pt;color:black'> </span><o:p></o:p></p>
<p><span style='font-size:10.0pt;color:black'>Joe</span><o:p></o:p></p>
<p><span style='font-size:10.0pt;color:black'> </span><o:p></o:p></p>
<p><span style='font-size:10.0pt;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><o:p></o:p></p>
<p><span style='font-size:10.0pt'> <b>double</b>
wrongVal=10-5*2 + 5*8-4;</span><o:p></o:p></p>
<p><span style='font-size:10.0pt'> </span><o:p></o:p></p>
<p><span style='font-size:10.0pt'> </span><o:p></o:p></p>
<p> <o:p></o:p></p>
</div>
</div>
<p class=MsoNormal style='margin-bottom:12.0pt'><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><o:p></o:p></p>
</div>
<p class=MsoNormal><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>
<o:p></o:p></p>
</div>
</body>
</html>