[fpc-pascal] Loss of precision when using math.Max()

Martok listbox at martoks-place.de
Mon Jul 16 12:32:29 CEST 2018


Am 14.07.2018 um 13:42 schrieb Florian Klämpfl:
>> 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.
Probably. All their current compilers are still pure win32 applications... I
have a suspicion that the fact that they put many x87 specific things in the
reference might be part of the reason.

This is impossible to replicate on FPC (without using the same softfloat on all
platforms), so the current situation is the only consistent solution.
It is missing documentation however: AFAICS, there is currently no reference for
real literal types, and a user inferring from Delphi will have the wrong
expectation.


Regards,

Martok




More information about the fpc-pascal mailing list