Can you open a JIRA plz? This way we don't lose this in the emails.
Thanks,
Edson
2009/3/16 Libor Nenadál <libor.nenadal(a)gmail.com>
The problem with BigDecimal is this:
(new BigDecimal("43.0")).equals(new BigDecimal("43")) is evaluated to
false
but
(new BigDecimal("43.0")).compareTo(new BigDecimal("43")) is evaluated
to 0
=> they are equal
Note that you should use String in constructor instead of double otherwise
you get something unpredictable - see
http://java.sun.com/j2se/1.4.2/docs/api/java/math/BigDecimal.html#BigDeci...
And because your evaluator uses equals, it is quite unusable. Is it
possible
to do some special wrapper for this type? Just for equality, other
operations would be nice to look like "x * y" but with division you need to
specify scale and therefore I think it is not possible to wrap it to some
nice look. :-(
Regards,
Libor
Edson Tirelli-3 wrote:
>
> It sounds like a bug. Can you get Drools source code and look at the
> unit
> test for this to make sure your scenario works there? The file is:
>
> drools-core/src/test/java/org/drools/base/EvaluatorFactoryTest.java
>
> Method is:
>
> testBigDecimal()
>
> Very easy to add your use case in there.
>
> Let us know what you find.
>
> Edson
>
>
--
View this message in context:
http://www.nabble.com/using-BigDecimal-in-rules-tp20362868p22539892.html
Sent from the drools - user mailing list archive at
Nabble.com.
_______________________________________________
rules-users mailing list
rules-users(a)lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users
--
Edson Tirelli
JBoss Drools Core Development
JBoss, a division of Red Hat @