[fpc-devel] certain divisions in single precision only
Florian Klämpfl
florian at freepascal.org
Sun Dec 8 18:41:20 CET 2019
Am 08.12.19 um 18:17 schrieb Martok:
>> Indeed, this is by design. See
>> https://wiki.freepascal.org/User_Changes_2.2.0#Floating_point_constants for
>> how to explicitly specify a different precision.
>
> That was long before the change Tomas discovered.
>
> The gotcha here is about your fix to
> <https://bugs.freepascal.org/view.php?id=25121>, which together with the one you
> linked made runtime and compile time evaluation the same, at the expense of
> specifically breaking Delphi compat.
>
> From the current Delphi Reference:
>
>> In Delphi, intermediate results of Single precision floating-point
>> expressions are always implicitly stored as Extended on x86.
>>
>> By default, all x64 arithmetic operations and expressions involving only
>> Single precision floating-point values retain high precision by storing
>> intermediate results as Double precision values.
>
> But since then, FPC sees Single / Int2Single = Single, with no high precision
> intermediates.
As the delphi behavior is very i386/x86-64 specific, FPC deviates from
it (not to mention that the non-i386 behavior was implemented years
before a non-i386 delphi was available).
More information about the fpc-devel
mailing list