[fpc-devel] Broken frac function in FPC3.1.1 / Windows x86_64
Mattias Gaertner
nc-gaertnma at netcologne.de
Fri Apr 27 19:38:52 CEST 2018
On Sat, 28 Apr 2018 02:48:14 +1000
"Thorsten Engler" <thorsten.engler at gmx.net> wrote:
> For what it’s worth, Delphi simply decided to give up on doing it correctly and silently fail if the double is too large to fit in an Int64.
>[...]
> WriteLn(Frac(1e15+0.5));
>
> WriteLn(Frac(1e16+0.5));
>
> When executed in 32bit code, returns:
That means it has the Extended 80bit type, so it can handle the
1e16+0.5.
http://docwiki.embarcadero.com/Libraries/Tokyo/en/System.Extended
> 5.00000000000000E-0001
>
> 5.00000000000000E-0001
>
>
>
> And when executed in 64bit code, returns:
That means it has only the 64bit double type, so the +0.5 is lost.
> 5.00000000000000E-0001
>
> 0.00000000000000E+0000
Mattias
More information about the fpc-devel
mailing list