Done a little test using 3 approachs (with new BigDecimal(-12.321)), all are 
working: 

rule "test big decimal 1"
when
        Pojo(bigDecimal < 0.0)
then
        System.out.println("test big decimal 1");
end

rule "test big decimal 2"
when
        Pojo(bigDecimal.doubleValue < 0.0)
then
        System.out.println("test big decimal 2");
end

rule "test big decimal 3"
when
        Pojo(bigDecimalValue < 0.0) // with 
then
        System.out.println("test big decimal 3");
end


with a wrapper method for the 3rd rule :

        public Double getBigDecimalValue() {
                if (bigDecimal == null) {
                        return null;
                } else {
                        return bigDecimal.doubleValue();
                }
        }


Your problem come from somewhere else (other conditions, wrong number in your 
object, missing import, too old version ...)


----- Mail original -----
De: "devan vanreenen" <devan.vanree...@gmail.com>
À: rules-users@lists.jboss.org
Envoyé: Dimanche 10 Juin 2012 19:38:42
Objet: [rules-users] BigDecimal comparison

Hi there, 

Please assist.
I have an object MaxCap that has a single property capAmount of type
BigDecimal.
The BigDecimal is negative

when the rule is 

MaxCap( capAmount.doubleValue < 0.00 )  it doesnt fire, which I expect it
should but when the rule is

MaxCap( capAmount.doubleValue > 0.00 )  then the rules fires, so the rule
recognises my negative number as a positive one.

Any help would be appreciated.

Thanks
Devan

--
View this message in context: 
http://drools.46999.n3.nabble.com/BigDecimal-comparison-tp4017841.html
Sent from the Drools: User forum mailing list archive at Nabble.com.
_______________________________________________
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users

_______________________________________________
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users

Reply via email to