<div dir="auto"><div class="gmail_quote" dir="auto"><div dir="ltr">Bart <<a href="mailto:bartjunk64@gmail.com">bartjunk64@gmail.com</a>> schrieb am Di., 15. Mai 2018, 13:22:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">On Sun, May 13, 2018 at 3:40 PM, Jonas Maebe <<a href="mailto:jonas@freepascal.org" target="_blank" rel="noreferrer">jonas@freepascal.org</a>> wrote:<br>
> The only proper way is to use something like Math.SameValue(x, int(x)).<br>
<br>
B.t.w. the test suite for the new Int() function (win64)<br>
(<a href="https://svn.freepascal.org/cgi-bin/viewvc.cgi/trunk/tests/tbs/tb0644.pp?view=markup" rel="noreferrer noreferrer" target="_blank">https://svn.freepascal.org/cgi-bin/viewvc.cgi/trunk/tests/tbs/tb0644.pp?view=markup</a>)<br>
uses<br>
<br>
47 function SameValue(aGot, aExpected: Double): Boolean;<br>
48 begin<br>
49 if IsNan(aExpected) then<br>
50 Result := IsNan(aGot)<br>
51 else<br>
52 Result := aGot = aExpected;<br>
53 end;<br></blockquote></div><div dir="auto"><br></div><div dir="auto">But that test tests a specific functionality and even remarks that it will only work on targets that have Double as default floating point type (e.g. Win64 and non-x86 targets). That test would fail on targets that have the Extended type or only Single. </div><div dir="auto">Thus it is safer (and more portable) to use Math.SameValue().</div><div dir="auto"><br></div><div dir="auto">Regards, </div><div dir="auto">Sven </div><div class="gmail_quote" dir="auto"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"></blockquote></div></div>