†† 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@gmail.com>

The problem with BigDecimal is this:
(new BigDecimal("43.0")).equals(new BigDecimal("43")) is evaluated to false
(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

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. :-(


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

†Edson Tirelli
†JBoss Drools Core Development
†JBoss, a division of Red Hat @ www.jboss.com