Details
-
Bug
-
Resolution: Unresolved
-
Major
-
None
-
5.3.0.Final
Description
Accuracy lost when comparing two numbers which has different number types. for example:
I have a pojo fact class 'Msg.java', and it has a int field named 'intVal', which value is inited 5.
And I write down this rule and run with default settings:
rule "out"
when
Msg(intVal == 5.5)
then
end
this rule would fire! but it shouldn't, cause 5 != 5.5.
It seems that drools converts the second operand of a comparison to the type of the first, no matter what the first number's type is. This definitely caused some accuracy lost in many cases.
if I wrote Msg(5.5 == intVal), the code behaves correctly.