Bart <bartjun...@gmail.com> schrieb am Di., 15. Mai 2018, 13:22:

> On Sun, May 13, 2018 at 3:40 PM, Jonas Maebe <jo...@freepascal.org> wrote:
> > The only proper way is to use something like Math.SameValue(x, int(x)).
>
> B.t.w. the test suite for the new Int() function (win64)
> (
> https://svn.freepascal.org/cgi-bin/viewvc.cgi/trunk/tests/tbs/tb0644.pp?view=markup
> )
> uses
>
> 47 function SameValue(aGot, aExpected: Double): Boolean;
> 48 begin
> 49 if IsNan(aExpected) then
> 50 Result := IsNan(aGot)
> 51 else
> 52 Result := aGot = aExpected;
> 53 end;
>

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.
Thus it is safer (and more portable) to use Math.SameValue().

Regards,
Sven

>
_______________________________________________
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Reply via email to