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

2022-07-30 Thread bugzilla-daemon
https://bugs.documentfoundation.org/show_bug.cgi?id=137679

m.a.riosv  changed:

   What|Removed |Added

 CC||mgua...@tiscalinet.it

--- Comment #73 from m.a.riosv  ---
*** Bug 150204 has been marked as a duplicate of this bug. ***

-- 
You are receiving this mail because:
You are the assignee for the bug.

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

2022-05-09 Thread bugzilla-daemon
https://bugs.documentfoundation.org/show_bug.cgi?id=137679

--- Comment #72 from b.  ---
just one point which wasn't clear enough to me in the past:  

the difference of a FP calculation vs. the user intended decimal calculation
adds up from:  
a.) the imprecision in the bin representation of the operands,  
b.) in operation rounding,  

e.g. '= 0.2 + 0.1' with doubles:  
0.2 bin representation is about 1.11E-17 overshot,  
0.1 bin representation is about 5.55E-18 overshot,  
and as the sum doesn't meet a double value it's rounded, in this case rounded
up, by additional 2.77E-17.  
this way we get the irritating 0.30004 as result.  

with 'Kahaning' or Neumaier we have access to the 2.77E-17 rounding difference,
not! to the representation deviations.  

thus 'by chance' a set with randomly distributed up and down deviations will
produce improved results with Kahan or Neumaier, while sets with 'systematic
drift' - e.g. all positive - will gain less benefit.

-- 
You are receiving this mail because:
You are the assignee for the bug.

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

2022-01-03 Thread bugzilla-daemon
https://bugs.documentfoundation.org/show_bug.cgi?id=137679

Eike Rathke  changed:

   What|Removed |Added

   See Also||https://bugs.documentfounda
   ||tion.org/show_bug.cgi?id=14
   ||6367

-- 
You are receiving this mail because:
You are the assignee for the bug.

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

2021-09-13 Thread bugzilla-daemon
https://bugs.documentfoundation.org/show_bug.cgi?id=137679

Xisco Faulí  changed:

   What|Removed |Added

 CC||stephane.guil...@member.fsf
   ||.org

--- Comment #71 from Xisco Faulí  ---
*** Bug 144156 has been marked as a duplicate of this bug. ***

-- 
You are receiving this mail because:
You are the assignee for the bug.

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

2021-06-18 Thread bugzilla-daemon
https://bugs.documentfoundation.org/show_bug.cgi?id=137679

Mike Kaganski  changed:

   What|Removed |Added

   See Also||https://bugs.documentfounda
   ||tion.org/show_bug.cgi?id=14
   ||2933

-- 
You are receiving this mail because:
You are the assignee for the bug.___
Libreoffice-bugs mailing list
Libreoffice-bugs@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-bugs


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

2021-05-15 Thread bugzilla-daemon
https://bugs.documentfoundation.org/show_bug.cgi?id=137679

dante19031...@gmail.com changed:

   What|Removed |Added

 Resolution|--- |FIXED
 Status|NEW |RESOLVED

-- 
You are receiving this mail because:
You are the assignee for the bug.___
Libreoffice-bugs mailing list
Libreoffice-bugs@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-bugs


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

2021-05-15 Thread bugzilla-daemon
https://bugs.documentfoundation.org/show_bug.cgi?id=137679

dante19031...@gmail.com changed:

   What|Removed |Added

   See Also||https://bugs.documentfounda
   ||tion.org/show_bug.cgi?id=14
   ||2307

-- 
You are receiving this mail because:
You are the assignee for the bug.___
Libreoffice-bugs mailing list
Libreoffice-bugs@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-bugs


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

2021-05-15 Thread bugzilla-daemon
https://bugs.documentfoundation.org/show_bug.cgi?id=137679

--- Comment #70 from dante19031...@gmail.com ---

> you had to 'truncate' Neumaier to fit it into SSE2? logically errors will
> occur]

It's just Kahan, not Neumanier wich is being used in SSE2 code.

-- 
You are receiving this mail because:
You are the assignee for the bug.___
Libreoffice-bugs mailing list
Libreoffice-bugs@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-bugs


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

2021-05-15 Thread bugzilla-daemon
https://bugs.documentfoundation.org/show_bug.cgi?id=137679

--- Comment #69 from b.  ---
as i'm not familiar with SSE2 ... would that: 

http://blog.zachbjornson.com/2019/08/11/fast-float-summation.html 

and that: 

https://gist.github.com/zbjornson/f90513fcaaee4d6268d26f9c1a0507dd#file-benchmark-cc
 

be helpful? 

IMHO that guy knows what he's dealing with ... 

[there might be even more errors in the code, 

(SSE2 is not optimal for Neumaier?)

the calculation of err1 - err4 should be 'dependent on summand size' as in 
if (std::abs(m_fSum) >= std::abs(x_i))
m_fError += (m_fSum - t) + x_i;
else
m_fError += (x_i - t) + m_fSum;   ??

rows 74-78 should evaluate err2 ?

rows 80-83 should evaluate err4 ?, and calculate a new err3 ?, 

rows 85-88 should evaluate the new err3 ?, and calculate a new err1 ?, 

the new err1 needs to be carried into subsequent calculations ?, either more
input to this sum or into the final result?, 

you had to 'truncate' Neumaier to fit it into SSE2? logically errors will
occur]

-- 
You are receiving this mail because:
You are the assignee for the bug.___
Libreoffice-bugs mailing list
Libreoffice-bugs@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-bugs


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

2021-05-15 Thread bugzilla-daemon
https://bugs.documentfoundation.org/show_bug.cgi?id=137679

--- Comment #68 from dante19031...@gmail.com ---
(In reply to b. from comment #67)

> 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 ... ??? 

I don't completely understand it. But by the info I found.
If I'm wrong don't hesitate to correct me.

The SSE2 does seem to make use of intel's SSE2 by giving instructions at almost
machine level, allowing direct access to the register. I suppose the purpose is
to boost speed (by a lot) (wikipedia says some AMD also use it).

We are performing 4 sums at the same time to use an optimization called loop
unrolling. It is supposed to speed up results by making the 4 operations at
same time. It's usually what modern hardware support.
However I'm not sure if it stills useful. It's generally only worth it if the
loop is very simple.

So in order to speed up calculations we enter in the very complicated stuff.
It's quite hardcore to find good documentation to that kind of thing.
Had to guess it by the functions definitions on the header, which by the way is
compiler specific.
I'm not even sure it is part of the standard. I don't believe Intel's
particular stuff could be part of the standard.

Due to those reasons I had to go for raw Kahan (does not sum the error at the
end, so in the last operations the error is ignored: err2 and err4 ).

> i'm in good hope you didn't forget to add the accumulated error as a last
> step (difference between Kahan and Neumaier)

It's there.
And everything was re-checked by expert programmers (while patch review).
So it should be fine.

-- 
You are receiving this mail because:
You are the assignee for the bug.___
Libreoffice-bugs mailing list
Libreoffice-bugs@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-bugs


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

2021-05-15 Thread bugzilla-daemon
https://bugs.documentfoundation.org/show_bug.cgi?id=137679

--- Comment #67 from b.  ---
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.___
Libreoffice-bugs mailing list
Libreoffice-bugs@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-bugs


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

2021-05-15 Thread bugzilla-daemon
https://bugs.documentfoundation.org/show_bug.cgi?id=137679

--- Comment #66 from dante19031...@gmail.com ---
(In reply to b. from comment #65)
> Created attachment 172026 [details]
> testsheet Neumaier Kahan–Babuška working well
> 
> hello @Dante, 
> 
> did some 'poking around', and - think - have found proof that better results
> are possible, 
> 
> would you mind having a look into the attached file, explanations in the
> sheet explanation, 
> 
> trying NeumaierSum from
> https://en.wikipedia.org/wiki/Kahan_summation_algorithm in a calc sheet,
> works, not 100%, but avoids the '12,45' fail. 
> 
> (as with all work / suggestions from me ... recheck at least twice!, i'm
> human and may fail) 
> 
> regards, 
> 
> b.

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 sum. You can check this first patch:
https://gerrit.libreoffice.org/c/core/+/114567
However it was considered overkill and downgraded to Neumanier sum.

So now I'm left with some doubts. Why Neumanier with calc and Neumanier with
C++ differ. I've rechecked all the code involved in the sum and seems
legitimate.

My theory is that the problem is in the SSE2 code.
For summing columns in theory you use the SSE2 which uses raw Kahan.
It's here: https://gerrit.libreoffice.org/c/core/+/115113

However using Neumanier in there is beyond my capacities.
Would suggest to create a new tdf for it.
That way someone who understands it could fix it.

Sorry to disappoint again.

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;
}

-- 
You are receiving this mail because:
You are the assignee for the bug.___
Libreoffice-bugs mailing list
Libreoffice-bugs@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-bugs


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

2021-05-15 Thread bugzilla-daemon
https://bugs.documentfoundation.org/show_bug.cgi?id=137679

--- Comment #65 from b.  ---
Created attachment 172026
  --> https://bugs.documentfoundation.org/attachment.cgi?id=172026=edit
testsheet Neumaier Kahan–Babuška working well

hello @Dante, 

did some 'poking around', and - think - have found proof that better results
are possible, 

would you mind having a look into the attached file, explanations in the sheet
explanation, 

trying NeumaierSum from https://en.wikipedia.org/wiki/Kahan_summation_algorithm
in a calc sheet, works, not 100%, but avoids the '12,45' fail. 

(as with all work / suggestions from me ... recheck at least twice!, i'm human
and may fail) 

regards, 

b.

-- 
You are receiving this mail because:
You are the assignee for the bug.___
Libreoffice-bugs mailing list
Libreoffice-bugs@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-bugs


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

2021-05-15 Thread bugzilla-daemon
https://bugs.documentfoundation.org/show_bug.cgi?id=137679

--- Comment #64 from Commit Notification 
 ---
dante committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/112c9d4b2d8a6393f52697c928e8ace06782b6e0

tdf#137679 Use KahanSum for Taylor series

It will be available in 7.2.0.

The patch should be included in the daily builds available at
https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
https://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.

-- 
You are receiving this mail because:
You are the assignee for the bug.___
Libreoffice-bugs mailing list
Libreoffice-bugs@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-bugs


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

2021-05-11 Thread bugzilla-daemon
https://bugs.documentfoundation.org/show_bug.cgi?id=137679

--- Comment #63 from Mike Kaganski  ---
(In reply to Mike Kaganski from comment #62)
> the deviation becoming 12.475 where it was 12.5

Sorry for the thinko - of course that was meant to be "2.475 where it was 2.5"

-- 
You are receiving this mail because:
You are the assignee for the bug.___
Libreoffice-bugs mailing list
Libreoffice-bugs@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-bugs


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

2021-05-11 Thread bugzilla-daemon
https://bugs.documentfoundation.org/show_bug.cgi?id=137679

--- Comment #62 from Mike Kaganski  ---
(In reply to dante19031999 from comment #61)

But yet Kahan has improved the resulting accuracy even in this problematic case
*a bit* (yes I realize how insignificant could this be - the deviation becoming
12.475 where it was 12.5; but anyway, introducing Kahan method can be expected
to at least not worsen the result, and in most cases improve).

The correct title of the bug reads: "to *reduce* the numerical error". Yes, it
is expected that the error is not eliminated completely here, but just reduced
where possible, since the method is not a miracle.

-- 
You are receiving this mail because:
You are the assignee for the bug.___
Libreoffice-bugs mailing list
Libreoffice-bugs@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-bugs


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

2021-05-11 Thread bugzilla-daemon
https://bugs.documentfoundation.org/show_bug.cgi?id=137679

--- Comment #61 from dante19031...@gmail.com ---
(In reply to b. from comment #60)
> add. tests: 
> 
> see already '1; 0,1; -1; 1; 0,1; -1; ...' failing, by ~5E-15, 
> and all similar sequences up to '1E15; 0,1; -1E15; ...' increasingly, while 
> '1E16; 0,1; -1E16; ...' and '1E17; 0,1; -1E17; ...' hold. 
> 
> are you at any point trapped by calcs 'built in prettyfiing'?

I finally understood what is going on when you told 1E16 and 1E17 hold.
You've got the chance of falling on what I would call a numerically unstable
zone.
Check this out:
https://en.wikipedia.org/wiki/Double-precision_floating-point_format
It basically says IEEE754 has 15,955 decimals.

Which means, for E16 and E17 you are falling out of range and 0.1 is being
summed at the error term. So all the info is perfectly being kept and you get
the good result.

However, if you are on E+15, you fall on the sum interval. Which means the last
bits of the sum and the error term are modified. That combined with 0.1 not
having exact binary representation you are accumulating error because of finite
precision. If you change 0.1 by 0.25 or 0.125 you get the good result.

I believe my example worked by pure chance because a unexpected convenient
correction of the error because of the order of the sum.

I'm afraid even Kahan Sum has it's limitations. Sorry to disappoint.

-- 
You are receiving this mail because:
You are the assignee for the bug.___
Libreoffice-bugs mailing list
Libreoffice-bugs@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-bugs


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

2021-05-11 Thread bugzilla-daemon
https://bugs.documentfoundation.org/show_bug.cgi?id=137679

--- Comment #60 from b.  ---
add. tests: 

see already '1; 0,1; -1; 1; 0,1; -1; ...' failing, by ~5E-15, 
and all similar sequences up to '1E15; 0,1; -1E15; ...' increasingly, while 
'1E16; 0,1; -1E16; ...' and '1E17; 0,1; -1E17; ...' hold. 

are you at any point trapped by calcs 'built in prettyfiing'?

-- 
You are receiving this mail because:
You are the assignee for the bug.___
Libreoffice-bugs mailing list
Libreoffice-bugs@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-bugs


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

2021-05-11 Thread bugzilla-daemon
https://bugs.documentfoundation.org/show_bug.cgi?id=137679

--- Comment #59 from b.  ---
hello @Dante, 

previous comment was the 'last needed patch'? 

testing with 7.2 ver. from 2021-05-11 ~04h, i see: 

your sample sheet working, 

mine 'kahan_sum with different versions' still failing (12,475), 

note that we have different operand sequences, you: 
1e15, 0.1, -1e15, 0.1, 1e15, 0.1, -1e15, 0.1, ... while i tested with: 
1e15, 0.1, -1e15, 1e15, 0.1, -1e15, ... 

tested my sheet fine with your data, 
your sheet failing with my data, 

pls. recheck if the mistake is on my side, 

Version: 7.2.0.0.alpha0+ (x64) / LibreOffice Community
Build ID: d7f734db2c078ced3ce08ad58cd816a79abe3bcf
CPU threads: 8; OS: Windows 6.1 Service Pack 1 Build 7601; UI render: default;
VCL: win
Locale: de-DE (de_DE); UI: en-US
Calc:

-- 
You are receiving this mail because:
You are the assignee for the bug.___
Libreoffice-bugs mailing list
Libreoffice-bugs@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-bugs


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

2021-05-10 Thread bugzilla-daemon
https://bugs.documentfoundation.org/show_bug.cgi?id=137679

--- Comment #58 from Commit Notification 
 ---
dante committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/a25c9a2925e64f3adb46a749ce18393aa01b1870

tdf#137679 Use KahanSum for SSE2

It will be available in 7.2.0.

The patch should be included in the daily builds available at
https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
https://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.

-- 
You are receiving this mail because:
You are the assignee for the bug.___
Libreoffice-bugs mailing list
Libreoffice-bugs@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-bugs


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

2021-05-08 Thread bugzilla-daemon
https://bugs.documentfoundation.org/show_bug.cgi?id=137679

--- Comment #57 from b.  ---
@Dante, 

thanks for the explanation, 

and please excuse my impatience, i think 'mathematically correct' is important
and i'm glad that something is going on, i'll wait patiently now. 

:-)  :-)  :-)

-- 
You are receiving this mail because:
You are the assignee for the bug.___
Libreoffice-bugs mailing list
Libreoffice-bugs@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-bugs


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

2021-05-08 Thread bugzilla-daemon
https://bugs.documentfoundation.org/show_bug.cgi?id=137679

--- Comment #56 from dante19031...@gmail.com ---
(In reply to b. from comment #55)
> Created attachment 171782 [details]
> testsheet kahan_sum with different versions
> 
> I don't see this working well yet.  
>   
> see attached sheet.  
>   
> Status: correct results are possible, calc can't do it yet.  
>   
> I hope i haven't messed up my system? please check the results. if the
> pending patches solve the problem just ignore this comment.

No you haven't.
I believe the function in charge of summing columns is this one:
ArraySumFunctor::executeSSE2
However, that patch stills on review because it touches non trivial stuff.
It's the last one, but I believe it will take 1 week -2 months,
So, please wait until this is merged:
https://gerrit.libreoffice.org/c/core/+/115113
And then you should get the same results as the example attachment I've
uploaded.

-- 
You are receiving this mail because:
You are the assignee for the bug.___
Libreoffice-bugs mailing list
Libreoffice-bugs@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-bugs


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

2021-05-08 Thread bugzilla-daemon
https://bugs.documentfoundation.org/show_bug.cgi?id=137679

--- Comment #55 from b.  ---
Created attachment 171782
  --> https://bugs.documentfoundation.org/attachment.cgi?id=171782=edit
testsheet kahan_sum with different versions

I don't see this working well yet.  

see attached sheet.  

Column A contains 100 times the three values 1E15; 0,1; -1E15.  

mathematically the sum over them should be 10.  

(difficult in FP-math, but solvable with Kahan summation).  

Column B contains partial sums, in cell B300 the sum over all values in
A1:A300.   

in cell C1 the value of B300 is copied, in C3:D6 the results calculated by
different calc versions and gnumeric.  

12.475000 result calc 7.2.0.0.a0+ 2021-05-08  
12.50 result calc 7.1.4.0.0 2021-05-08  
12.50 result calc 6.1.6.3  
10.00 result gnumeric 1.12.17  

Status: correct results are possible, calc can't do it yet.  

I hope i haven't messed up my system? please check the results. if the pending
patches solve the problem just ignore this comment.

-- 
You are receiving this mail because:
You are the assignee for the bug.___
Libreoffice-bugs mailing list
Libreoffice-bugs@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-bugs


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

2021-05-08 Thread bugzilla-daemon
https://bugs.documentfoundation.org/show_bug.cgi?id=137679

Adolfo Jayme  changed:

   What|Removed |Added

Summary|Implement a Kahan summation |Implement a Kahan summation
   |algorithm for reduce the|algorithm to reduce the
   |numerical error in the  |numerical error in the
   |total   |total

-- 
You are receiving this mail because:
You are the assignee for the bug.___
Libreoffice-bugs mailing list
Libreoffice-bugs@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-bugs


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

2021-05-08 Thread bugzilla-daemon
https://bugs.documentfoundation.org/show_bug.cgi?id=137679

--- Comment #54 from Commit Notification 
 ---
dante committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/5545d8f515a2f7af45f0d2ab3ee40dfbde7fa20f

tdf#137679 Use Kahan summation for interpr3.cxx (2/2)

It will be available in 7.2.0.

The patch should be included in the daily builds available at
https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
https://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.

-- 
You are receiving this mail because:
You are the assignee for the bug.___
Libreoffice-bugs mailing list
Libreoffice-bugs@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-bugs


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

2021-05-07 Thread bugzilla-daemon
https://bugs.documentfoundation.org/show_bug.cgi?id=137679

--- Comment #53 from dante19031...@gmail.com ---
(In reply to Eike Rathke from comment #52)
> Yes indeed, https://gerrit.libreoffice.org/q/topic:%22kahansum%22+status:open

There are 3 left to merge ...
And it doesn't require many more review.

OK: affected functions:
lcl_GetSumProduct
lcl_GetColumnEuclideanNorm
lcl_TGetColumnEuclideanNorm
lcl_GetColumnMaximumNorm
lcl_GetColumnSumProduct
lcl_TGetColumnSumProduct
lcl_SolveWithUpperRightTriangle
lcl_SolveWithLowerLeftTriangle
lcl_ApplyUpperRightTriangle
lcl_GetMeanOverAll
lcl_CalculateColumnMeans
lcl_CalculateRowMeans
lcl_GetSSresid
lcl_IterResult
lcl_IterateInverse
lcl_MFastMult
lcl_LUP_solve
lcl_GetBinomDistRange
class NumericCellAccumulator
class ScMatrix
class FuncSum
class IterateMatrix ( SUM COUNT COUNT2 PRODUCT SUMSQ AVERAGE )
class ArraySumFunctor ( SSE2 may take a while to review )
ScSumXMY2
ScRawSubtract !!! NOT AFFECTED !!!
ScSumIfs
ScAverageIfs
ScNPV
ScIRR
ScMIRR
ScISPMT
ScDB
ScInterVDB
ScVDB
ScCumIpmt
ScCumPrinc
ScSumProduct
ScHarMean
ScGeoMean
ScStandard
ScAveDev
ScDevSq
ScForecast
SCFTest by after effects of a future patch completely unrelated
ScMatMult
ScChiTest
ScTTest
ScZTest
ScHypGeomDist
ScPoissonDist
ScCritBinom
CalculateSkew
CalculatePearsonCovar
CalculateSlopeIntercept
CalculateSumX2MY2SumX2DY2
CalculateRGPRKP
CalculateTest
IterateParameters
PreprocessDataRange
prefillTrendData
prefillPerIdx
calcAccuracyIndicators
CalcPeriodLen
GetStVarParams
IterateParametersIf
DBIterator
GetDBStVarParams

AND ANY WHICH DEPENDS ON THIS
I believe I haven't left anything to do and also listed everything.

-- 
You are receiving this mail because:
You are the assignee for the bug.___
Libreoffice-bugs mailing list
Libreoffice-bugs@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-bugs


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

2021-05-07 Thread bugzilla-daemon
https://bugs.documentfoundation.org/show_bug.cgi?id=137679

--- Comment #52 from Eike Rathke  ---
Yes indeed, https://gerrit.libreoffice.org/q/topic:%22kahansum%22+status:open

-- 
You are receiving this mail because:
You are the assignee for the bug.___
Libreoffice-bugs mailing list
Libreoffice-bugs@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-bugs


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

2021-05-07 Thread bugzilla-daemon
https://bugs.documentfoundation.org/show_bug.cgi?id=137679

--- Comment #51 from Roman Kuznetsov <79045_79...@mail.ru> ---
(In reply to Eike Rathke from comment #50)
> (In reply to dante19031999 from comment #48)
> > I've already done what I could.
> > On my part it's done.
> Anything missing in the KahanSum implementation? If not then let's set this
> bug's status to RESOLVED FIXED.

I still see some unmerged patches in gerrit

-- 
You are receiving this mail because:
You are the assignee for the bug.___
Libreoffice-bugs mailing list
Libreoffice-bugs@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-bugs


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

2021-05-07 Thread bugzilla-daemon
https://bugs.documentfoundation.org/show_bug.cgi?id=137679

--- Comment #50 from Eike Rathke  ---
(In reply to dante19031999 from comment #48)
> I've already done what I could.
> On my part it's done.
Anything missing in the KahanSum implementation? If not then let's set this
bug's status to RESOLVED FIXED.

And thanks for doing the tedious work!

Could you provide a list of affected spreadsheet functions so we can mention it
in the release notes?

-- 
You are receiving this mail because:
You are the assignee for the bug.___
Libreoffice-bugs mailing list
Libreoffice-bugs@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-bugs


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

2021-05-07 Thread bugzilla-daemon
https://bugs.documentfoundation.org/show_bug.cgi?id=137679

--- Comment #49 from Commit Notification 
 ---
dante committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/38c88aca77f8c8ef47470723557ddf9e5d9d7b66

tdf#137679 Use Kahan summation for interpr8.cxx

It will be available in 7.2.0.

The patch should be included in the daily builds available at
https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
https://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.

-- 
You are receiving this mail because:
You are the assignee for the bug.___
Libreoffice-bugs mailing list
Libreoffice-bugs@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-bugs


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

2021-05-07 Thread bugzilla-daemon
https://bugs.documentfoundation.org/show_bug.cgi?id=137679

dante19031...@gmail.com changed:

   What|Removed |Added

   Assignee|dante19031...@gmail.com |libreoffice-b...@lists.free
   ||desktop.org
 Status|ASSIGNED|NEW

--- Comment #48 from dante19031...@gmail.com ---
I've already done what I could.
On my part it's done.

-- 
You are receiving this mail because:
You are the assignee for the bug.___
Libreoffice-bugs mailing list
Libreoffice-bugs@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-bugs


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

2021-04-28 Thread bugzilla-daemon
https://bugs.documentfoundation.org/show_bug.cgi?id=137679

Xisco Faulí  changed:

   What|Removed |Added

   Assignee|libreoffice-b...@lists.free |dante19031...@gmail.com
   |desktop.org |

-- 
You are receiving this mail because:
You are the assignee for the bug.___
Libreoffice-bugs mailing list
Libreoffice-bugs@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-bugs


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

2021-04-28 Thread bugzilla-daemon
https://bugs.documentfoundation.org/show_bug.cgi?id=137679

--- Comment #28 from Commit Notification 
 ---
dante committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/fd4df675dfe1012448285134082f61a0c03a7d15

tdf#137679 Use Kahan summation for scmatrix operations

It will be available in 7.2.0.

The patch should be included in the daily builds available at
https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
https://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.

-- 
You are receiving this mail because:
You are the assignee for the bug.___
Libreoffice-bugs mailing list
Libreoffice-bugs@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-bugs


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

2021-04-28 Thread bugzilla-daemon
https://bugs.documentfoundation.org/show_bug.cgi?id=137679

Commit Notification  changed:

   What|Removed |Added

 Whiteboard||target:7.2.0

-- 
You are receiving this mail because:
You are the assignee for the bug.___
Libreoffice-bugs mailing list
Libreoffice-bugs@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-bugs


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

2021-04-26 Thread bugzilla-daemon
https://bugs.documentfoundation.org/show_bug.cgi?id=137679

Roman Kuznetsov <79045_79...@mail.ru> changed:

   What|Removed |Added

 Status|NEW |ASSIGNED

--- Comment #27 from Roman Kuznetsov <79045_79...@mail.ru> ---
I don't know why, but Dante didn't write a link to bug report in his patches:

https://gerrit.libreoffice.org/c/core/+/114567 - added a Kahan summation class

https://gerrit.libreoffice.org/c/core/+/114612 - Use kahan sum for lcl_ named
methods in abstract namespace

-- 
You are receiving this mail because:
You are the assignee for the bug.___
Libreoffice-bugs mailing list
Libreoffice-bugs@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-bugs


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

2021-04-22 Thread bugzilla-daemon
https://bugs.documentfoundation.org/show_bug.cgi?id=137679

--- Comment #26 from Mike Kaganski  ---
(In reply to dante19031999 from comment #25)

Looks perfectly reasonable - looking forward for the patch! :-)

-- 
You are receiving this mail because:
You are the assignee for the bug.___
Libreoffice-bugs mailing list
Libreoffice-bugs@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-bugs


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

2021-04-22 Thread bugzilla-daemon
https://bugs.documentfoundation.org/show_bug.cgi?id=137679

--- Comment #25 from dante19031...@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.___
Libreoffice-bugs mailing list
Libreoffice-bugs@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-bugs


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

2021-04-21 Thread bugzilla-daemon
https://bugs.documentfoundation.org/show_bug.cgi?id=137679

--- Comment #24 from b.  ---
hello @Roman Kuznetsov, 

you are right, but no need to shout (capitals), and no need to shout especially
at me, it was @Mike Kaganski who pulled another issue here, my comment c#14 was
'that doesn't fit', 

btw. do you make progress with the Kahan thing? 

@Mike Kaganski and @erAck: propose to continue 'operand ordering' / 'processing
sequence' in tdf#140691

-- 
You are receiving this mail because:
You are the assignee for the bug.___
Libreoffice-bugs mailing list
Libreoffice-bugs@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-bugs


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

2021-04-21 Thread bugzilla-daemon
https://bugs.documentfoundation.org/show_bug.cgi?id=137679

Roman Kuznetsov <79045_79...@mail.ru> changed:

   What|Removed |Added

 CC||79045_79...@mail.ru

--- Comment #23 from Roman Kuznetsov <79045_79...@mail.ru> ---
(In reply to b. from comment #22)
> (In reply to Eike Rathke from comment #19)


PLEASE STOP THE DISCUSSION HERE. IF YOU WANT TALK WITH DEVELOPERS THEN WRITE
THEM INTO MAILING LIST

HERE IS A SPECIFIC REPORT ABOUT A SPECIFIC REALIZATION OF THE KAHAN'S
ALGORITHM. AND IT'S ALL. ALL OTHER THINGS SHOULD BE IN OTHER PLACES

-- 
You are receiving this mail because:
You are the assignee for the bug.___
Libreoffice-bugs mailing list
Libreoffice-bugs@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-bugs


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

2021-04-21 Thread bugzilla-daemon
https://bugs.documentfoundation.org/show_bug.cgi?id=137679

--- Comment #22 from b.  ---
(In reply to Eike Rathke from comment #19)
> For RAWSUBTRACT() we could make it such that the arguments are processed
> from left to right by reversing the stack, which would be more "natural" and
> expected.

hello @erAck, 
1. think that makes sense, 
2. be aware that there are plenty other functions affected as well, 
3. as having no 'standard' (M.K.) and as it would make sense to have a standard
or at least a guideline because it's affecting results ... would you consider
start discussing this in the appropriate circles?

-- 
You are receiving this mail because:
You are the assignee for the bug.___
Libreoffice-bugs mailing list
Libreoffice-bugs@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-bugs


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

2021-04-21 Thread bugzilla-daemon
https://bugs.documentfoundation.org/show_bug.cgi?id=137679

--- Comment #21 from Mike Kaganski  ---
(In reply to b. from comment #20)

Lol, you clearly try to convert some help from my side into looking bad. No
problem :-) Just keep in mind, that:

1. I explained the situation in simple words in comment 15:

> This is due to natural processing order of the arguments of a function in Calc

2. I did not write the code of the function, and I only can point you to what
exists;

3. I made some effort to find the only place in existence that has the
information that you need;

4. You sound as if you *demand* me to spend my time parsing the code and
converting its algorithm into user language, telling that any code pointer is
an insult.

-- 
You are receiving this mail because:
You are the assignee for the bug.___
Libreoffice-bugs mailing list
Libreoffice-bugs@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-bugs


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

2021-04-21 Thread bugzilla-daemon
https://bugs.documentfoundation.org/show_bug.cgi?id=137679

--- Comment #20 from b.  ---
(In reply to Mike Kaganski from comment #17)

i have rarely heard more stupid nonsense than declaring code to be its own
documentation. i know such approaches used to exist, but in cryptolanguages
like C this is silly. in order to analyze idiosyncratic functions or errors of
a program, there needs to be an explanation outside the code of what the
program is supposed to do, how it is supposed to work, what restrictions it is
subject to, and so on. 'we do fp-math as it is historically grown and our dear
@Mike Kaganski (doesn't) understand it' is not enough (for me). 

> (In reply to b. from comment #16)
> > If you can point me to an concise explanation where is explained how calc
> > works with details about deviations to 'standard math' i'd possibly ask less
> > silly questions ...
> 
> Yes, it's documented in the source code. E.g., RAWSUBTRACT is at
> https://opengrok.libreoffice.org/xref/core/sc/source/core/tool/interpr6.
> cxx?r=f3fc16f4=38325=1068#1068

-- 
You are receiving this mail because:
You are the assignee for the bug.___
Libreoffice-bugs mailing list
Libreoffice-bugs@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-bugs


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

2021-04-20 Thread bugzilla-daemon
https://bugs.documentfoundation.org/show_bug.cgi?id=137679

--- Comment #19 from Eike Rathke  ---
For RAWSUBTRACT() we could make it such that the arguments are processed from
left to right by reversing the stack, which would be more "natural" and
expected.

-- 
You are receiving this mail because:
You are the assignee for the bug.___
Libreoffice-bugs mailing list
Libreoffice-bugs@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-bugs


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

2021-04-20 Thread bugzilla-daemon
https://bugs.documentfoundation.org/show_bug.cgi?id=137679

--- Comment #18 from TheWebMachine  ---
(In reply to Mike Kaganski from comment #17)
> Yes, it's documented in the source code. E.g., RAWSUBTRACT is at
> https://opengrok.libreoffice.org/xref/core/sc/source/core/tool/interpr6.
> cxx?r=f3fc16f4=38325=1068#1068

Fantastic! Now, how about writing up a real "easy" human doc explaining it for
everyone the hell else, since the vast majority of Calc users aren't the least
bit interested in your coding skills? Given your superior intellect, you should
be able to whip up a comprehensive dissertation for us plebs even whilst in a
coma!

It's "nice" to see you weren't just being a belittling, condescending a$$hat
towards me, personally...it's apparently just who. you. are. Full stop.

-- 
You are receiving this mail because:
You are the assignee for the bug.___
Libreoffice-bugs mailing list
Libreoffice-bugs@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-bugs


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

2021-04-20 Thread bugzilla-daemon
https://bugs.documentfoundation.org/show_bug.cgi?id=137679

--- Comment #17 from Mike Kaganski  ---
(In reply to b. from comment #16)
> If you can point me to an concise explanation where is explained how calc
> works with details about deviations to 'standard math' i'd possibly ask less
> silly questions ...

Yes, it's documented in the source code. E.g., RAWSUBTRACT is at
https://opengrok.libreoffice.org/xref/core/sc/source/core/tool/interpr6.cxx?r=f3fc16f4=38325=1068#1068

-- 
You are receiving this mail because:
You are the assignee for the bug.___
Libreoffice-bugs mailing list
Libreoffice-bugs@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-bugs


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

2021-04-20 Thread bugzilla-daemon
https://bugs.documentfoundation.org/show_bug.cgi?id=137679

--- Comment #16 from b.  ---
(In reply to Mike Kaganski from comment #15)
> (In reply to b. from comment #14)
...
> =1E+016 - 1 - 1E+016 gives 0, while
> =RAWSUBTRACT(1E+016;1;1E+016) gives -1;

good pinpointing, thanks, sometimes i have a feeling about a problem but am
short in bringing it precisely 'to the point', 

> This is due to natural processing order of the arguments of a function in
> Calc, 

*ugggh*, that's a 'big point'!, sorry, some of the following is OT for
'Kahan' but 1. have to write it somewhere, 2. it's affecting 'Kahan' too, 

some points, where i can't decide which is more important, 

1. if that - special 'right to left processing' - is really in all functions it
might affect more results, (it is in processing of ranges and affects ex$el
compatibility, see tdf#140691), 

2. it is - in some respects - effective and intelligent to work that way, but
contradicts 'normal occidental way of thinking', and a central point of good
programming is not only to be 'somehow circumstantially explainable "right"',
but to deliver what the user knows, understands, needs, what best matches his
expectations and 'normal mathematics'. 

3. there is! a mathematical convention that operations of the same priority
(exponention before 'point calculation' before 'dash calculation'), if not
ordered by brackets, are to be processed 'from left to right', isn't it?. 

4. it is questionable whether calc's calculation of a sum '=sum(A3:D3)' in the
order D3 + C3 + B3 + A3 is compatible with this convention ... ('=sum(D3:A3)'
is not supported by calc, the input is changed arbitrarily).

5. compatibility - it would make sense if different spreadsheets produce
'similar' results, and deviations to 'the big' can be justified with
'mathematically correct' or 'better', but hardly with anything else. 

> (that is *unspecified* by ODF!) 
is a shortcoming as processing sequence affects results, doe's IEEE say
something about that? 

> (which is not complex by the way, just needs an easy hacker to handle it).
in principle 'Kahan' is simple, but knitting it in the big and complex code
base and all the idiosyncrasies of calc could be difficult and requires a
experienced dev, - imho - 

> "alternative" fix that would make a single person in the universe happy).

Please don't always insult me as too idiosyncratic, 'exotic' or too individual,
I don't deal with these topics for fun, but so that errors can be eliminated
and less people suffer from them and the consequential errors of what the
developers were not sufficiently aware of when programming. I could not know
beforehand how deep the causes of any problems lie, but i'm sure it's necessary
to dig to the bottom. The more problems remain in basic functions the more crap
they inject into more complex functions that build on them. 

If you can point me to an concise explanation where is explained how calc works
with details about deviations to 'standard math' i'd possibly ask less silly
questions ...

-- 
You are receiving this mail because:
You are the assignee for the bug.___
Libreoffice-bugs mailing list
Libreoffice-bugs@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-bugs


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

2021-04-19 Thread bugzilla-daemon
https://bugs.documentfoundation.org/show_bug.cgi?id=137679

--- Comment #15 from Mike Kaganski  ---
(In reply to b. from comment #14)

I agree that order of RAWSUBTRACT is inconsistent with normal subtraction. As
you wrote in bug 141752 comment 0,

=1E+016 - 1 - 1E+016 gives 0, while
=RAWSUBTRACT(1E+016;1;1E+016) gives -1;

=1E+016 - 1E+016 - 1 gives -1, while
=RAWSUBTRACT(1E+016;1E+016;1) gives 0.

This is due to natural processing order of the arguments of a function in Calc,
(that is *unspecified* by ODF!) and reversing it is possible here (forming a
vector of arguments before performing negations), but is completely useless in
view of Kahan summation algorithm (which is not complex by the way, just needs
an easy hacker to handle it).

Your bug was actually useful that it highlighted that RAWSUBTRACT is also a
subject to the Kahan (or more precisely, improved Kahan–Babuška) algorithm
implementation, so also is covered by this bug. Spending even one minute on an
alternative "fix" of bug 141752 is just a waste of developers' time , and I
disagree with "unduping" (but anyone is still free to suggest a patch with
"alternative" fix that would make a single person in the universe happy).

-- 
You are receiving this mail because:
You are the assignee for the bug.___
Libreoffice-bugs mailing list
Libreoffice-bugs@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-bugs


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

2021-04-19 Thread bugzilla-daemon
https://bugs.documentfoundation.org/show_bug.cgi?id=137679

--- Comment #14 from b.  ---
(In reply to Mike Kaganski from comment #13)
> *** Bug 141752 has been marked as a duplicate of this bug. ***

don't think that fits, 'Kahan' if implemented might solve the other problem,
but Kahan is 'not so easy' it'll take some time ... 

in the meantime the rawsubtract-sequence can be solved by other means, e.g.
calculation sequence as the subtrahends are numbered ... 

think it might lead to circles if rawsubtract is used - and neccessary? - to
calculate the 'kahan artefacts', and one would use kahan inside rawsubtract to
avoid deviations from operand ordering ... ??? 

propose unduping,

-- 
You are receiving this mail because:
You are the assignee for the bug.___
Libreoffice-bugs mailing list
Libreoffice-bugs@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-bugs


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

2021-04-18 Thread bugzilla-daemon
https://bugs.documentfoundation.org/show_bug.cgi?id=137679

--- Comment #13 from Mike Kaganski  ---
*** Bug 141752 has been marked as a duplicate of this bug. ***

-- 
You are receiving this mail because:
You are the assignee for the bug.___
Libreoffice-bugs mailing list
Libreoffice-bugs@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-bugs


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

2021-04-13 Thread bugzilla-daemon
https://bugs.documentfoundation.org/show_bug.cgi?id=137679

TheWebMachine  changed:

   What|Removed |Added

 CC||thewebmach...@gmail.com

--- Comment #12 from TheWebMachine  ---
*** Bug 141614 has been marked as a duplicate of this bug. ***

-- 
You are receiving this mail because:
You are the assignee for the bug.___
Libreoffice-bugs mailing list
Libreoffice-bugs@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-bugs


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

2021-03-16 Thread bugzilla-daemon
https://bugs.documentfoundation.org/show_bug.cgi?id=137679

Buovjaga  changed:

   What|Removed |Added

 CC||dante19031...@gmail.com

--- Comment #11 from Buovjaga  ---
(In reply to Mike Kaganski from comment #10)
> (In reply to dante19031999 from comment #9)
> 
> It is very unfortunate if the code readability stops you from implementing
> this. Please don't hesitate to propose a change on gerrit, where we could
> discuss code structure further.
> 
> Thanks!

Dante: FYI

-- 
You are receiving this mail because:
You are the assignee for the bug.___
Libreoffice-bugs mailing list
Libreoffice-bugs@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-bugs


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

2021-03-16 Thread bugzilla-daemon
https://bugs.documentfoundation.org/show_bug.cgi?id=137679

--- Comment #10 from Mike Kaganski  ---
(In reply to dante19031999 from comment #9)

It is very unfortunate if the code readability stops you from implementing
this. Please don't hesitate to propose a change on gerrit, where we could
discuss code structure further.

Thanks!

-- 
You are receiving this mail because:
You are the assignee for the bug.___
Libreoffice-bugs mailing list
Libreoffice-bugs@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-bugs


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

2021-02-09 Thread bugzilla-daemon
https://bugs.documentfoundation.org/show_bug.cgi?id=137679

dante19031...@gmail.com changed:

   What|Removed |Added

   Assignee|dante19031...@gmail.com |libreoffice-b...@lists.free
   ||desktop.org
 Status|ASSIGNED|NEW

--- Comment #9 from dante19031...@gmail.com ---
Sorry, I could easily introduce code for it. But it would make the code there
already is even more impossible tor read. There might be a proper form to do
it.

-- 
You are receiving this mail because:
You are the assignee for the bug.___
Libreoffice-bugs mailing list
Libreoffice-bugs@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-bugs


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

2020-12-09 Thread bugzilla-daemon
https://bugs.documentfoundation.org/show_bug.cgi?id=137679

dante19031...@gmail.com changed:

   What|Removed |Added

   Assignee|libreoffice-b...@lists.free |dante19031...@gmail.com
   |desktop.org |

-- 
You are receiving this mail because:
You are the assignee for the bug.___
Libreoffice-bugs mailing list
Libreoffice-bugs@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-bugs


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

2020-12-09 Thread bugzilla-daemon
https://bugs.documentfoundation.org/show_bug.cgi?id=137679

--- Comment #8 from Eike Rathke  ---
@b., again your example is something different and not related to whether or
not the Kahan algorithm is used.

-- 
You are receiving this mail because:
You are the assignee for the bug.___
Libreoffice-bugs mailing list
Libreoffice-bugs@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-bugs


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

2020-11-22 Thread bugzilla-daemon
https://bugs.documentfoundation.org/show_bug.cgi?id=137679

--- Comment #7 from b.  ---
@Roman and @erAck: 

i am glad about all efforts for better and correct calculations in calc, please
be aware that as long as calc calculates as it currently does (unspecific
rounding), all efforts suffer from rounding errors, and it is hard to see if
they improve anything, 

an exotic but simple and clear example, i'm in doubt if the following error can
be fixed with 'Kahan':
'=(2^53+31-2^53)+(2^53-31-2^53)+(2^53+31-2^53)+(2^53-31-2^53)' should result in
'0' (the subterms in brackets cancel each other out), but calc calculates '64'
(and any amount more if you repeat the sequence), 

@erAck: before you press the 'off topic' or 'no value' buzzer ... i'm aware
that above is another bug and will file one, but pls. consider ... it's exactly
what 'Kahan' is designed for, avoiding the accumulation of small errors, and
Roman will have problems to see the bottom of the lake while other influences
crumble the surface and stir up mud ... 

a simple and clear example for such a clouded view: with the above formula and
the result '0' in calc version 4.1.6.2 one could assume this version had been
better ... far from it ... try
'=(2^53+33-2^53)+(2^53-33-2^53)+(2^53+33-2^53)+(2^53-33-2^53)', similar with
3.5.1.2, thus 'old bug', 

ex$el (2010) fails too, '2', that's inside the precision of IEEE 754
(granularity 2 above 2^53), it is not! unavoidable, but would require some
effort, e.g. 'term reordering' or perhaps Kahan can help in that situation ...

-- 
You are receiving this mail because:
You are the assignee for the bug.___
Libreoffice-bugs mailing list
Libreoffice-bugs@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-bugs


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

2020-10-23 Thread bugzilla-daemon
https://bugs.documentfoundation.org/show_bug.cgi?id=137679

--- Comment #6 from b.  ---
@erAck: a little too rough tone, but of course, you are the more experienced, 

i'll be happy if there is hope to get rid of theese annoying problems with help
from Roman and Kahan, 

besides having written too long ... imho 

- limited help for some special cases, 
- no help against decimal -> fp conversion artefacts, 
- requires a processing sequence adapted to the solution, 

are important when considering how best to address the issue - am i wrong in
this?

-- 
You are receiving this mail because:
You are the assignee for the bug.___
Libreoffice-bugs mailing list
Libreoffice-bugs@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-bugs


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

2020-10-22 Thread bugzilla-daemon
https://bugs.documentfoundation.org/show_bug.cgi?id=137679

--- Comment #5 from Eike Rathke  ---
@Roman: yes, go ahead please.

-- 
You are receiving this mail because:
You are the assignee for the bug.___
Libreoffice-bugs mailing list
Libreoffice-bugs@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-bugs


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

2020-10-22 Thread bugzilla-daemon
https://bugs.documentfoundation.org/show_bug.cgi?id=137679

--- Comment #4 from Eike Rathke  ---
b., could you *PLEASE* not hijack this with your pet peeves? Thanks.

-- 
You are receiving this mail because:
You are the assignee for the bug.___
Libreoffice-bugs mailing list
Libreoffice-bugs@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-bugs


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

2020-10-22 Thread bugzilla-daemon
https://bugs.documentfoundation.org/show_bug.cgi?id=137679

b.  changed:

   What|Removed |Added

 Ever confirmed|0   |1
 CC||newbie...@gmx.de
 Status|UNCONFIRMED |NEW

--- Comment #3 from b.  ---
hello @Roman, 

full support, yes, calc (and other spreadsheets) need better precision, less
errors, less complaints, 

on a first glance i'd say 'Kahan' is good for some special (but common) cases,
chained summation of plenty small numbers to one bigger value what suffers from
truncation / rounding errors because only a part of the mantissa of the small
values is included in the calculation, 

but it fails for plenty other tasks, and requires an 'intelligent overview of
the task' which - i assume - spreadsheets normally don't have, as well as some
effort to re-organize the calculations to combine atomic calculations together,
thus 'performance impact' and 'error prone', 

and i'd expect it capable to avoid 'summation artefacts', but not the common
user noticed errors resulting from decimal -> binary conversion, 

similar for 'argument sorting', 

imho better proposals: 

1.) IEEE 754-2008 decimals, could someone with knowlegde have a look ifn't gcc
already has that implemented? i'd read something about a decimal64 data type /
library, 

2.) smart rounding acc. to the input (strings, or dec-value representation, not
'fp'), thoose reflect the precision submitted and expected by the user ...
would require storing a property 'precision' alongside with the values, and
after each operation round acc. to the input and operation, tried it with 'user
macros', slow but works, should be faster in code, 

difficulties: either changed data representation neccessary to track the
precision, or fetch input (cell.string) for each operation and calculate from
that ... both bad impact but better than the user has to formulate every
calculation with 'round', 

advantage of 1. and 2. over Kahan: they can also correct / suppress errors in
other calculations such as MOD, DATE, dragfill etc. 

3.) spontaneous idea: round the fp-representation of decimals to 48 (+1)
mantissa bits, and take the last four bits (which in most cases are rounded
away by calc's 'round to 15 digits' anway), and store the 'decimal precision'
there ( for "no rounding!", 0001 to  for '1 to 15' decimal digits),
thus you can reliably 'round away' most fp-conversion and fp-calculation
artefacts for the typical user data (e.g. finance sheets) with less 'user
irritating' errors becoming visible ... 

e.g. calculating 0,1 + 0,2 would become 1.0009E-1 +
2.0018E-1, thus 3.0027E-1, but with! the info 'rounding
to one decimal digit is! correct', and thus become exact dec 0,3 which is much
better than having 3.0004E-1 and an arbitrary decision 'round or
not', 

the calculated value would be:
0b0_001_(1)0011001100110011001100110011001100110011001100111000 
rounded for 48/49 bit storing to 
0b0_001_(1)001100110011001100110011001100110011001100110100(0001), thus 
3.007E-1

while a calculation from dec 0,3 would result in bin: 
0b0_001_(1)0011001100110011001100110011001100110011001100110011
rounded for 48/49 bit storing to 
0b0_001_(1)001100110011001100110011001100110011001100110011(0001), thus 
2.998E-1

that's a little more 'off' than neccessary, but ... reliable values!, both for
sure "0,3" und thus for sure equal!, and for comparisions calc can look 'low
precision' and apply 'wide range', 

just a half-baked idea on a rainy evening that i like to throw in the
discussion, don't be annoyed if i suggest creative nonsense, it was time enough
that reasonable people could have solved the problem better ... to drag it
along forever is worse than my funny suggestions ... ??? 

me as a soothsayer ... it won't be long before someone classifies this bug as a
duplicate of one of the 40++ fp-precision bugs whose resolved-duplicate chains
are gradually biting each other's tails, and it falls into oblivion over time
...

-- 
You are receiving this mail because:
You are the assignee for the bug.___
Libreoffice-bugs mailing list
Libreoffice-bugs@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-bugs


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

2020-10-22 Thread bugzilla-daemon
https://bugs.documentfoundation.org/show_bug.cgi?id=137679

--- Comment #2 from Noel Grandin  ---
Sure, you're welcome to work on this

-- 
You are receiving this mail because:
You are the assignee for the bug.___
Libreoffice-bugs mailing list
Libreoffice-bugs@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-bugs


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

2020-10-22 Thread bugzilla-daemon
https://bugs.documentfoundation.org/show_bug.cgi?id=137679

Roman Kuznetsov <79045_79...@mail.ru> changed:

   What|Removed |Added

 CC||er...@redhat.com,
   ||noelgran...@gmail.com

--- Comment #1 from Roman Kuznetsov <79045_79...@mail.ru> ---
Noel, Eike, what's your opinion here?

-- 
You are receiving this mail because:
You are the assignee for the bug.___
Libreoffice-bugs mailing list
Libreoffice-bugs@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-bugs


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

2020-10-22 Thread bugzilla-daemon
https://bugs.documentfoundation.org/show_bug.cgi?id=137679

Roman Kuznetsov <79045_79...@mail.ru> changed:

   What|Removed |Added

 Blocks||109324
 CC||mikekagan...@hotmail.com
   Keywords||difficultyInteresting,
   ||easyHack


Referenced Bugs:

https://bugs.documentfoundation.org/show_bug.cgi?id=109324
[Bug 109324] [META] Calculate bugs and enhancements
-- 
You are receiving this mail because:
You are the assignee for the bug.___
Libreoffice-bugs mailing list
Libreoffice-bugs@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-bugs