<br> Can you open a JIRA plz? This way we don't lose this in the emails.<br><br> Thanks,<br> Edson<br><br><div class="gmail_quote">2009/3/16 Libor Nenadál <span dir="ltr"><<a href="mailto:libor.nenadal@gmail.com">libor.nenadal@gmail.com</a>></span><br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><br>
The problem with BigDecimal is this:<br>
(new BigDecimal("43.0")).equals(new BigDecimal("43")) is evaluated to false<br>
but<br>
(new BigDecimal("43.0")).compareTo(new BigDecimal("43")) is evaluated to 0<br>
=> they are equal<br>
<br>
Note that you should use String in constructor instead of double otherwise<br>
you get something unpredictable - see<br>
<a href="http://java.sun.com/j2se/1.4.2/docs/api/java/math/BigDecimal.html#BigDecimal%28double%29" target="_blank">http://java.sun.com/j2se/1.4.2/docs/api/java/math/BigDecimal.html#BigDecimal(double)</a><br>
<br>
And because your evaluator uses equals, it is quite unusable. Is it possible<br>
to do some special wrapper for this type? Just for equality, other<br>
operations would be nice to look like "x * y" but with division you need to<br>
specify scale and therefore I think it is not possible to wrap it to some<br>
nice look. :-(<br>
<br>
Regards,<br>
Libor<br>
<div class="im"><br>
<br>
Edson Tirelli-3 wrote:<br>
><br>
> It sounds like a bug. Can you get Drools source code and look at the<br>
> unit<br>
> test for this to make sure your scenario works there? The file is:<br>
><br>
> drools-core/src/test/java/org/drools/base/EvaluatorFactoryTest.java<br>
><br>
> Method is:<br>
><br>
> testBigDecimal()<br>
><br>
> Very easy to add your use case in there.<br>
><br>
> Let us know what you find.<br>
><br>
> Edson<br>
><br>
><br>
<br>
</div><font color="#888888">--<br>
View this message in context: <a href="http://www.nabble.com/using-BigDecimal-in-rules-tp20362868p22539892.html" target="_blank">http://www.nabble.com/using-BigDecimal-in-rules-tp20362868p22539892.html</a><br>
Sent from the drools - user mailing list archive at Nabble.com.<br>
</font><div><div></div><div class="h5"><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><br>
</div></div></blockquote></div><br><br clear="all"><br>-- <br> Edson Tirelli<br> JBoss Drools Core Development<br> JBoss, a division of Red Hat @ <a href="http://www.jboss.com">www.jboss.com</a><br>