Accuracy lost when comparing numbers
------------------------------------
Key: JBRULES-3338
URL:
https://issues.jboss.org/browse/JBRULES-3338
Project: Drools
Issue Type: Bug
Security Level: Public (Everyone can see)
Components: drools-core (expert)
Affects Versions: 5.3.0.Final
Environment: sun jdk 1.6u27, drools 5.3.0 final
Reporter: Miles Wen
Assignee: Mark Proctor
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.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators:
https://issues.jboss.org/secure/ContactAdministrators!default.jspa
For more information on JIRA, see:
http://www.atlassian.com/software/jira