Mark Proctor wrote:
Joe White wrote:

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,

Drop in the newer MVEL, I believe this is fixed - if it's not open a JIRA over at MVEL.
http://mvel.codehaus.org/
Sorry correction, it's fixed in MVEL trunk, the author will do a binary release soon.

 

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


_______________________________________________ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users