[rules-users] Mvel autoboxing math

Joe White Joe.White at recondotech.com
Fri Aug 15 01:32:54 EDT 2008


The drl test case below illustrates a problem with math inside of drools
when using the mvel dialect. When using autoboxing the order of
operations (and parens)  are not respected. This is using drools 5.0M1
and mvel-2.0-dp4.jar. The correct answer is 80 and the answer provided
with autoboxing in the mvel dialect is 100.

 

I'm uncertain of how to create a viable test case in pure mvel to add it
to their jira. Any help is appreciated,

 

Thanks,

 

Joe

 

 

package test;

 

dialect "mvel"

 

rule "TestRule"

      when

      then

            

            double value=(2*new Double("50"))-10-10;

            System.out.println(value);

            

            double valueTwo=(2*50)-10-10;

            System.out.println(valueTwo);

End

 

RESULTS

Wrong = 100.0

Right = 80.0

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/rules-users/attachments/20080814/406e7827/attachment.html 


More information about the rules-users mailing list