www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - Third attempt for SUM

reply Ilya Yaroshenko <ilyayaroshenko gmail.com> writes:
Hi all,

Advanced summation algorithms [3] from Mir project [1] are ready 
to be merged to Phobos. Many thanks to Walter Bright for the new 
Dlang floating point semantic [2].

Best regards,
Ilya

1. https://github.com/libmir/mir
2. https://github.com/dlang/dmd/pull/6247
3. https://github.com/dlang/phobos/pull/4896
Nov 12 2016
parent reply safety0ff <safety0ff.dev gmail.com> writes:
On Saturday, 12 November 2016 at 15:37:29 UTC, Ilya Yaroshenko 
wrote:
 Hi all,

 Advanced summation algorithms [3] from Mir project [1] are 
 ready to be merged to Phobos.
Hi, Do you have any thoughts at to when Kahan should be used over KBN? I was testing summation for a program (summing logarithms of primes as doubles,) and KBN seemed to be slightly outperforming Kahan.
Nov 13 2016
parent reply Ilya Yaroshenko <ilyayaroshenko gmail.com> writes:
On Sunday, 13 November 2016 at 16:04:51 UTC, safety0ff wrote:
 On Saturday, 12 November 2016 at 15:37:29 UTC, Ilya Yaroshenko 
 wrote:
 Hi all,

 Advanced summation algorithms [3] from Mir project [1] are 
 ready to be merged to Phobos.
Hi, Do you have any thoughts at to when Kahan should be used over KBN? I was testing summation for a program (summing logarithms of primes as doubles,) and KBN seemed to be slightly outperforming Kahan.
Yes, KBN should be used instead Kahan when possible (for example Quaternions can not be summed using default KBN implementation). BTW, i have implemented sumOfLogs [1], it is more precise then everything else.
Nov 13 2016
next sibling parent jmh530 <john.michael.hall gmail.com> writes:
On Sunday, 13 November 2016 at 16:56:30 UTC, Ilya Yaroshenko 
wrote:
 Yes, KBN should be used instead Kahan when possible (for 
 example Quaternions can not be summed using default KBN 
 implementation).

 BTW, i have implemented sumOfLogs [1], it is more precise then 
 everything else.


Can you re-order the examples or something so that the first one is an example of how it would be used most commonly? The last one looks like it should be first, and then maybe only with additional explanation (that these are some rarer cases) should the others be there.
Nov 13 2016
prev sibling parent safety0ff <safety0ff.dev gmail.com> writes:
On Sunday, 13 November 2016 at 16:56:30 UTC, Ilya Yaroshenko 
wrote:
 BTW, i have implemented sumOfLogs [1], it is more precise then 
 everything else.
Thanks, I was going to use 32.64 fixed point for my program but now I think I will get better precision modifying that to use a 32 bit exponent field with a 1.64 fixed point field (to represent [1,2) normalized number.) The [0.5,1) normalization due to frexp was confusing at first glance.
Nov 14 2016