[rules-users] Double Handling

Wolfgang Laun wolfgang.laun at gmail.com
Sun Apr 11 04:11:19 EDT 2010


You are comparing a double to a String ("85"). Although MVEL might convert
strings to numbers, I wouldn't use this without some cogent reason.

Do you have this unexpected firing also when you use a double literal, i.e.,
85.0 ?

-W


2010/4/9 Ade Timi <adeyinka.timi at nathean.com>

>  Hi,
>
>
>
> I am new to Drools. I am having a problem comparing 2 double values. I have
> a Java class with a double attribute called loanToValue. The loanToValue is
> been read from an XML file and the value is 92000.0. Based on this value I
> do not expect this rule to be fired, but for some reason it does. And the
> print statement returns 92000.0. Does anyone know what I’m doing wrong? My
> rule looks as follows:
>
>
>
> *rule* "G2 Equity in Asset"
>
>       *ruleflow-group* "goods"
>
>       *dialect* "mvel"
>
>       *when*
>
>             $d : IndividualDecision()
>
>             Individual(*eval*($d.getLoanToValue() < "85"))
>
>       *then*
>
>             System.out.println("loanToValue: " + ($d.getLoanToValue()));
>
> *end*
>
> * *
>
> Thanks,
>
> Ade
>
>
>
> *Adeyinka Timi* | Technical Supprt | *Nathean Technologies Ltd*
>
> Registered Office 3 Lyncon Court, IDA Science & Technology Park, Snugborough
> Road, Blanchardstown, Dublin 15, Ireland
> *T +353 1 685 3001* | VOIP 076 615 1117 | *E adeyinka.timi at nathean.com* |
> <http://www.nathean.com/>www.nathean.com
>
> Incorporated in Ireland, No. 339972
>
> The information appearing in this email and any files transmitted with it
> is confidential and may not be reproduced, modified, distributed,
> transmitted, displayed, published or broadcast without the prior written
> permission of Nathean Technologies Ltd. It is intended solely for the use of
> the addressee(s). Nathean Technologies Ltd, its directors, officers and
> employees do not accept liability for any loss or damage of any nature
> howsoever arising pertaining to the use of information appearing in this
> email and/or any files transmitted with it. Whilst this email has been
> checked for the presence of computer viruses, Nathean Technologies Ltd does
> not, except as required by law, represent, warrant and/or guarantee that the
> integrity of this communication has been maintained nor that the
> communication is free of errors, viruses, interception or interference.
>
>
>
> _______________________________________________
> rules-users mailing list
> rules-users at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/rules-users/attachments/20100411/aebddde7/attachment.html 


More information about the rules-users mailing list