[fpc-pascal] Loss of precision when using math.Max()
Florian Klämpfl
florian at freepascal.org
Sat Jul 14 13:42:28 CEST 2018
Am 13.07.2018 um 16:36 schrieb Martok:
> Am 12.07.2018 um 23:38 schrieb Florian Klämpfl:
>> This will result in different results for runtime and compile time calculated expressions => bad idea.
>
> Aye, doing the same at runtime and compile time would be the sane idea.
>
> Still, the Delphi(32) compiler always works with Extended precision at compile
> time. See
> <http://docwiki.embarcadero.com/RADStudio/Tokyo/en/Declared_Constants#True_Constants>:
> "If constantExpression is a real, its type is Extended" - that type then propagates.
Yes, this is for sure x87 inheritance. On x87 it is in practice always the case that operations are carried out with
extended precision.
>
>
> The other links were about intermediates of runtime calculations, so this change
> is correct:
>> I have added support for the directive $EXCESSPRECISION: it forces that all binary float operations are executed with
>> the highest available precision available for the currently selected FPU
> On that commit, am I blind or is this the same expression twice?
> <https://github.com/graemeg/freepascal/blob/340c0b3b/compiler/nadd.pas#L159>
>
>
More information about the fpc-pascal
mailing list