Issue 9134 - Cumulative error in formulas gives incorrect answer - BESSELJ
Summary: Cumulative error in formulas gives incorrect answer - BESSELJ
Status: CLOSED FIXED
Alias: None
Product: Calc
Classification: Application
Component: code (show other issues)
Version: OOo 1.0.1
Hardware: PC Windows 2000
: P2 Trivial with 1 vote (vote)
Target Milestone: ---
Assignee: oc
QA Contact: issues@sc
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2002-11-09 19:02 UTC by Unknown
Modified: 2013-08-07 15:12 UTC (History)
1 user (show)

See Also:
Issue Type: DEFECT
Latest Confirmation in: ---
Developer Difficulty: ---


Attachments
OpenOffice Calc accumulates too much error compared with Excel (49.00 KB, application/octet-stream)
2002-11-09 19:04 UTC, Unknown
no flags Details
test of all BESSEL functions (1000.00 KB, application/octet-stream)
2003-06-03 09:59 UTC, daniel.rentz
no flags Details

Note You need to log in before you can comment on or make changes to this issue.
Description Unknown 2002-11-09 19:02:35 UTC
Our research lab has a benchmark spreadsheet (Excel) used to compare speed of
the computers we buy.  I can import this into OpenOffice just fine, but
OpenOffice Calc gives the wrong answers.

I believe that I know the correct answer, because I also have Mathematica to
compare with.

I have cut down the 256 column by 2500 row sheet to a 256 column 3 row sheet
which shows the problem.  (One could just copy the 3rd row all the way down to
recover my original benchmark).
 
A1=1.3
The first row iterates the formula Sqrt((cell to left)^2+1)
The first column iterates the formula Sqrt((cell above)^2+1)

The other cells have the formula of the form 
IV1==SQRT(IU1^2+1)  [ For the first row ]
IV2=Log10(ABS(BESSELJ(IV1;$A3)))+IU2
IV3=Log10(ABS(BESSELJ(IV2;$A3)))+IU3
In general:
cell=Log10(ABS(BESSELJ((cell above);(cell in same row, first column))))+(cell to
left)

OpenOffice eventually give error 502 in most cells.

The problem can still be seen with the simpler formula, which I am using for
this bug report.  Simply drop the call to Log10:
IV1=SQRT(IU1^2+1)  [ For the first row ]
IV2=ABS(BESSELJ(IV1;$A3))+IU2
IV3=ABS(BESSELJ(IV2;$A3))+IU3
In general
cell=ABS(BESSELJ((cell above);(cell in same row, first column)))+(cell to left)
Where the first row/column are still 1.3 or the sqrt iteration given above

Now the IV3 result (256th column, 3rd row) results are
Mathematica gives 30.0811386942866761144975205
Excel gives       30.08113874136690000000
OpenOffice gives 516.52017959013400000000

So you can see why I am distressed.  OpenOffice ends up wildly off,
while Excel is correct to 9 digits.

It would seem your BesselJ function is simply not getting enough digits
of accuracy compared with Excel.
Comment 1 Unknown 2002-11-09 19:04:41 UTC
Created attachment 3547 [details]
OpenOffice Calc accumulates too much error compared with Excel
Comment 2 peter.junge 2003-05-26 17:55:59 UTC
Hi Daniel,
could you please check this. I just tried it with OOo1.0.3 and
OOo1.1Beta2 (on Linux) and both threw different results that are not
even the same as the result that the submitter reported for OOo1.0.1.

Peter
Comment 3 daniel.rentz 2003-05-27 06:40:20 UTC
started
Comment 4 daniel.rentz 2003-05-27 07:37:21 UTC
The result of J1(x) goes completely out of scope for x>30. Therefore 
the third line in the attached doc becomes completely wrong.
Comment 5 niklas.nebel 2003-06-02 11:08:47 UTC
Review done.
Comment 6 daniel.rentz 2003-06-02 14:06:42 UTC
fixed in srx645/dr4 (OOo 1.1 RC).
Comment 7 daniel.rentz 2003-06-03 08:31:50 UTC
owner->QA
Comment 8 daniel.rentz 2003-06-03 09:59:18 UTC
Created attachment 6609 [details]
test of all BESSEL functions
Comment 9 oc 2003-06-03 15:41:52 UTC
reset resolution to fixed
Comment 10 oc 2003-06-03 15:42:06 UTC
verified in internal build dr4
Comment 11 oc 2003-07-16 09:29:08 UTC
Fixed and verified in OOo1.1RC