[Libreoffice-bugs] [Bug 137679] Implement a Kahan summation algorithm to reduce the numerical error in the total

bugzilla-daemon at bugs.documentfoundation.org bugzilla-daemon at bugs.documentfoundation.org
Sat May 15 20:41:29 UTC 2021


https://bugs.documentfoundation.org/show_bug.cgi?id=137679

--- Comment #67 from b. <newbie-02 at gmx.de> ---
hello @Dante,  

from a short amateur! look in
https://gerrit.libreoffice.org/c/core/+/115113/4/sc/source/core/tool/arraysumSSE2.cxx#30
I would think that: 
- you tried to add 'Neumaier' into 'Kahan' and 'pairwise' instead of replacing
the whole construct ... unnecessarily complicated? and that 
- 'err2' and 'err4' have 'fallen by the wayside', i.e. are calculated in 'sum2'
and 'sum4' but not evaluated in the rest of the construct ... ??? 

bear with me if i'm mistaken ... 

even if that's not 'the point' I would say 'now we have the fish by the ears'
:-)  

> I could say I'm a precision freak and always try to get the best possible result even if at expenses of calculation time. 
:-) 

> However calc philosophy is the opposite. 
:-( 

> I did try to use Klein ... downgraded to Neumanier sum. 
if Neumaier would work it would be 'something', 

> Why Neumanier with calc and Neumanier with C++ differ. I've rechecked all the code involved in the sum and seems legitimate.
:-( but!:  
i have often faced incomprehensible problems in life and in various fields,
from the point where i had a working and a non-working way to compare them ...
all problems lost. They became 'analyzable'. insofar :-)

> My theory is that the problem is in the SSE2 code.
> ... 
> That way someone who understands it could fix it.
I am hopeful that someone will find it, 

> Sorry to disappoint again.
no, not at all, not in the least, you have moved things forward! great! 

> This is the sum code:
    void add(double x_i)
    {
        double t = m_fSum + x_i;
        if (std::abs(m_fSum) >= std::abs(x_i))
            m_fError += (m_fSum - t) + x_i;
        else
            m_fError += (x_i - t) + m_fSum;
        m_fSum = t;
    }

i'm in good hope you didn't forget to add the accumulated error as a last step
(difference between Kahan and Neumaier), and thus can't contribute to the
coding part, 
I'm glad if you have looked through my 'in sheet' attempts and also think that
they work, then sooner or later a solution will arise ... thank you very much!  


P.S. 1e16 and 1e17 'holding' might have been an error by me taking the wrong
dataset, or putting it into the wrong sheet, or messing up 0.1, 1e1, 1e-1, 1,
10 ... or recalc / no autocalc or whatever, retrying it doesn't hold, but holds
in gnumeric, 

my general idea is that pretty good accuracy is possible as it's achieved by
gnumeric, i've asked Morten how they do and he said 'use an extension of Kahan
summation', as @Mike Kaganski is afraid LO might get trouble looking at
gnumeric for inspiration i have additional asked if Morten would see a problem
in that, not yet answered, will keep you posted.

-- 
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/libreoffice-bugs/attachments/20210515/d446c28a/attachment.htm>


More information about the Libreoffice-bugs mailing list