Apache OpenOffice (AOO) Bugzilla – Issue 122997
Calculation error in the IMABS() function
Last modified: 2017-05-20 10:33:37 UTC
There is a calculation error in the IMABS() function for complex numbers. For example =IMABS(COMPLEX(0;5)) gives 25 as result, instead of correct value 5. Missed square root in the implementation? It's a regression, version 3.4.1 works fine. Thank you.
Error is in scaddins/source/analysis/analysishelper.hxx around line 833 Methode inline double Complex::Abs( void) const { return std::norm( Num ); } should likely be return std::abs( Num );
Thank you Regina. This one may be related? =IMSQRT(-4) --> 2.44948974278318+3.16227766016838i (wrong result) Must be 2i
Yes. Other functions use abs internally and are wrong too. [If nobody is faster than I, I will fix it next week.]
"regina" committed SVN revision 1512966 into trunk: #i122997 Calculation error in IMABS() function
Created attachment 81314 [details] To be commited to branch AOO400
Created attachment 81315 [details] Test over all IMxxx functions Besides rounding errors in last digit, the calculated and the expected values should be the same.
approve showstopper request
taking over to merge Regina's fix into branch AOO401 - branch for AOO 4.0.1 release
"orw" committed SVN revision 1515328 into branches/AOO401: #i122997 Calculation error in IMABS() function
cherry-picked Regina's fix on trunk to merge it into branch AOO401 --> issue is now fixed for AOO 4.0.1
*** Issue 123071 has been marked as a duplicate of this issue. ***
Created attachment 81386 [details] Reworked testcases, so that a single cell shows whether the calculations have a regression The testfile covers all complex functions in alphabetic order. A single cell shows whether there is a regression in calculation.
Based on Regina's complete testcases doc, I am getting FALSE on the following calculation: =IMCOS("-5+12i") To my "eyes", the results in col C, and D are the same: col C -- 23083.6899151345-78034.7601517634i col D -- 23083.6899151346-78034.7601517635i In the helper app section, the result of abs(re(B)-re(C)) is: 1.01863406598568E-010 The other helper apps jive. Maybe needs a few more tweaks? Thanks to Regina for this great work!
(In reply to Kay from comment #13) > To my "eyes", the results in col C, and D are the same: > > col C -- 23083.6899151345-78034.7601517634i > col D -- 23083.6899151346-78034.7601517635i I think it's a normal floating point approximation. Seems OK to me.