My gut instinct would say that this is possibly correct.
I’ve not looked at the mvel code but if all your types are strings then it makes sense for it to pick the most type specific operator first. Multiplication
only works on numbers so it attempts to convert them but the + operator is defined on strings and therefore is a closer match for strings as you are assigning the result to a string.
I haven’t tried it but you could liberally sprinkling in brackets and type casts to get what you want, eg:
t.out = (double)(t.in2*t.in3) + (double)(t.in3*t.in4) + (double)(t.in2*t.in4);
Thomas
From: rules-users-bounces@lists.jboss.org [mailto:rules-users-bounces@lists.jboss.org]
On Behalf Of Kinshuk Adhikary
Sent: 21 December 2009 02:48
To: rules-users@lists.jboss.org
Subject: [rules-users] Re-sending : Unexpected MVEL plus operator behavior(string-to-double), in consequence block
Using |