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

bugzilla-daemon at bugs.documentfoundation.org bugzilla-daemon at bugs.documentfoundation.org
Thu Apr 22 16:55:24 UTC 2021


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

--- Comment #25 from dante19031999 at gmail.com ---
About this issue, what makes the code most illegible is the fact that you are
using only one function to perform multiple tasks (sum, average, count, ...)
and at same time has to deal with multiple possible input types (double,
integer, boolean, text, ...) in a double loop with nested switchs.

Would like to propose an idea:

Without changing the structure of the code, instead of directly implementing
Kahan inside the loop, use a kahan summation class. This class contains 3
doubles: the value, the error and the second order error (I believe is enought
for general purpose software). This class also overloads the '+' operator which
internally handles the sum. Also would have a get double method for returning
the final result.

However I'm not an informatic engineer and have no idea of the efficiency
impact this would have. So if someone who understands about that kind of issue
thinks it's a fine way of implementing it I would propose a patch in gerrit.

This class would also be usable for any other operation with this kind of need.

-- 
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/20210422/4e20d1a0/attachment.htm>


More information about the Libreoffice-bugs mailing list