Expected precision of Fortran FE constant evaluation
Toon Moene
toon@moene.org
Mon Feb 11 21:44:00 GMT 2019
On 2/11/19 8:40 PM, Thomas König wrote:
> Hi Salvatore,
>
>> Right, try this preprint
>> https://www.researchgate.net/publication/298896236_Remark_on_Algorithm_539_Carefully_Computing_the_Euclidean_Norm
>>
>> Apart from typesetting to an older style it looks essentially the same
>
> Interesting reading.
>
> Regarding the algorithm the authors propose, I have one concern.
> The first part of their algorithm is (translating their pseudocode into
> Fortran, resulting errors are mine)
>
> Â real :: sm, s, t
>
> Â sm = 0.
> Â s = 0.
> Â do i=1, n
> Â Â Â Â s = s + x(i)**2
> Â Â Â Â t = sm
> Â Â Â Â sm = t + s
> Â Â Â Â s = s + (t-sm)
> Â end do
> Â norm2 = sqrt(sm)
Isn't this simply an application of Kahan summation ?
https://en.wikipedia.org/wiki/Kahan_summation_algorithm
...
--
Toon Moene - e-mail: toon@moene.org - phone: +31 346 214290
Saturnushof 14, 3738 XG Maartensdijk, The Netherlands
At home: http://moene.org/~toon/; weather: http://moene.org/~hirlam/
Progress of GNU Fortran: http://gcc.gnu.org/wiki/GFortran#news
More information about the Fortran
mailing list