[fpc-devel] Extended type

Florian Klämpfl florian at freepascal.org
Wed Apr 20 15:02:00 CEST 2011


Am 20.04.2011 15:04, schrieb Hans-Peter Diettrich:
> Florian Klämpfl schrieb:
>> Am 20.04.2011 00:05, schrieb Hans-Peter Diettrich:
>>> Florian Klaempfl schrieb:
>>>
>>>> Using extended typically hides only bad numerical algorithms. There
>>>> might be some corner cases where extended is usefull but I general I
>>>> think it's a matter of bad algorithms.
>>> Some algorithms convert faster with increased accuracy.
>>
>> I guess you meant converge?
> 
> Right. I had a phone call just while answering :-(
> 
>> This might be true, but processing of
>> extended types is also slower: the memory footprint increases and even
>> worse, extended arrays are typically aligned to 4 or even 16 byte
>> borders so they take 12 or 16 byte in memory.
> 
> Please don't mix up the internal processing and the external storage of
> the values. Type coercion (expansion) is frequently used in the
> evaluation of expressions, be inside a GPU or FPU.

Actually, this is even another problem of the x87 fpu: expressions are
often evaluted more precisely than required thus resulting in
unpredicatable results because it depends on the compiler if it stores a
temp. value during evaluation of an expression in memory or not. The
correct solution to round after each operation is too slow, everything
else is unpredictable.



More information about the fpc-devel mailing list