<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">2014-12-26 22:46 GMT+01:00 Nicolas Cellier <span dir="ltr">&lt;<a href="mailto:nicolas.cellier.aka.nice@gmail.com" target="_blank">nicolas.cellier.aka.nice@gmail.com</a>&gt;</span>:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">2014-12-26 19:44 GMT+01:00 Eliot Miranda <span dir="ltr">&lt;<a href="mailto:eliot.miranda@gmail.com" target="_blank">eliot.miranda@gmail.com</a>&gt;</span>:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"> <br><div dir="ltr">Hi Nicolas,<br><div class="gmail_extra"><br><div class="gmail_quote"><span class="">On Fri, Dec 26, 2014 at 7:48 AM, Nicolas Cellier <span dir="ltr">&lt;<a href="mailto:nicolas.cellier.aka.nice@gmail.com" target="_blank">nicolas.cellier.aka.nice@gmail.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"> <br><div dir="ltr"><div><div><div><div>One of the problem I foresee is this one:<br><br>    1.0e17 &gt;= 100000000000000001<br><br></div>indeed, the (generated) primitive currently convert the SmallInteger to double, and this one is true:<br><br>    1.0e17 &gt;= 100000000000000001 asFloat<br><br></div>In 32 bit Spur/COG with 30 bit max magnitude, it was OK because every conversion SmallInteger -&gt; Double was exact - like all integer in the range [-2^53,2^53] - see Float class&gt;&gt;maxExactInteger<br><br></div>In 64 bits Spur, this might not be the case anymore since some SmallInteger exceed this range...<br></div></div></blockquote><div><br></div></span><div>Thanks for the head&#39;s up.  You&#39;re quite right:</div><div><br></div><div>(1 &lt;&lt; 60 - 1) asFloat asInteger = (1 &lt;&lt; 60 - 1) false</div><span class=""><div><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div>So the (generated) primitive must be protected with some range test.</div></div></blockquote><div><br></div></span><div>So in cases where we do double CMP integer or integer CMP double the primitive must fail if the SmallInteger has more than 52 bits of significance? </div></div></div></div></blockquote><div><br></div><div>Well, up to 53 bits it&#39;s OK to convert an integer to a double, it&#39;s lossless.<br><br></div><div> <br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><div> That&#39;s reasonable.  I need to review the StackInterpreter code to make sure it does the same.  I&#39;m pretty sure it doesn&#39;t do so right now.</div></div></div></div></blockquote><div><br></div><div>#primitiveLessThan does only compare integers, but #bytecodePrimLessThan tries to be smarter and invoke #primitiveFloatLess:thanArg: then #loadFloatOrIntFrom:<br> <br></div></div></div></div></blockquote><div><br></div><div>So defining a specialized  loadFloatOrInt53From: for float/integer compare primitive/bytecode may do the job...<br><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><div></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div class="gmail_extra"><div><br></div><span class=""><font color="#888888">-- <br><div>best,<div>Eliot</div></div>
</font></span></div></div><span class=""><font color="#888888">
<br></font></span></blockquote></div><br></div></div>
</blockquote></div><br></div></div>