Ramya Loganathan
Ramya Loganathan

Reputation: 1

Is there an in-built support to add epsilon as an input parameter for double comparsions with mvel dialect?

I am using mvel dialect for defining rules for drools rule engine. It may comprise of arithmetic expressions like in the when part as shown below

rule "Test rule"
    dialect "mvel"
when
    context : ActionContext( context.get("test") == 0.8 )
then
context.add("Success" , "test");

end

I want the execution of rules to consider an epsilon value whenever there is a double comparison. As far as i went through the mvel library and internet search space i couldnt find a straightforward solution. But this seems like a common problem. Does mvel support this feature in any way?

Note : i don't want to use BigDecimal considering the performance implications.

Something i can do is write a custom function for every double comparison. But this seems like the last thing to do. Is there a better way?

Upvotes: 0

Views: 30

Answers (0)

Related Questions