hi there,<div>I have a simple fact class:</div><div><br></div><div><div>public class Msg {</div><div> private Long lo = 5l;</div><div> private double dbl = 5.5;</div><div><br></div><div> public Long getLo() {</div>
<div> return lo;</div><div> }</div><div><br></div><div> public void setLo(Long lo) {</div><div> this.lo = lo;</div><div> }</div><div><br></div><div> public double getDbl() {</div><div> return dbl;</div>
<div> }</div><div><br></div><div> public void setDbl(double dbl) {</div><div> this.dbl = dbl;</div><div> }</div><div>}</div></div><div><br></div><div>and a simple drl program:</div><div><br></div><div><div>
package com.sample</div><div><br></div><div>import com.sample.Msg;</div><div><br></div><div>rule "Hello World"</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>when</div><div><span class="Apple-tab-span" style="white-space:pre">                </span>m:Msg(lo >= dbl)<span class="Apple-tab-span" style="white-space:pre">        </span></div>
<div><span class="Apple-tab-span" style="white-space:pre">        </span>then</div><div><span class="Apple-tab-span" style="white-space:pre">                </span>System.out.println( "hello world" );</div><div><span class="Apple-tab-span" style="white-space:pre">                </span>System.out.println(m.getLo());</div>
<div><span class="Apple-tab-span" style="white-space:pre">                </span>System.out.println(m.getDbl());</div><div>end</div></div><div><br></div><div>I simply compare the Long value, which is 5, to the double value ,which is 5.5, with operator '>=', and the output is:</div>
<div><br></div><div><div>hello world</div><div>5</div><div>5.5</div></div><div><br></div><div>but it can't be ,cause 5 is less than 5.5.</div><div>then I modified the drl program a bit:</div><div><br></div><div>m:Msg(lo == dbl)</div>
<div><br></div><div>It successfully prints out the message as well.It seems that drools treated the double value '5.5' as '5' in comparing... </div><div>Is this a bug or something?What could I do to correct it?</div>
<div>thanks.</div>