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

Martok listbox at martoks-place.de
Fri Jul 13 16:36:47 CEST 2018


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.
So Real literal minimisation (Jonas' original change only exposed it) is another
one for the portability notes.


Speaking of which, who is admin for the wiki (I couldn't find any contact
information)? It would be really useful to have the "Cite" extension available.
It should be bundled, just needs to be enabled.


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>


-- 
Regards,
Martok




More information about the fpc-pascal mailing list