Two Statistical Calculations Derek O’Connor
1.1 The
Sea Surface Heights
Problem
The following information was taken from a paper [4], by Yun He & Chris Ding of theNERSC-Lawrence Berkeley Labs who were doing a large-scale simulation of ocean circula-tion. At each step of the simulation the following was done:1.
Sea Surface Heights
are calculated at each point on a 64
×
120 latitude-longitudegrid.2. The average of these 64
×
120
=
7680 numbers is then calculated.3. This average is compared with satellite data.The Fortran code below does the summation part of these calculations.
sum = 0.0do i = 1, 64
latitude index
do j = 1, 120
longitude index
sum = sum + ssh(i,j)end doend do
The order of summation can be changed by interchanging the
i
and
j
indices and by revers-ing their order.Table 1: He and Ding’s Results using 16-digit Precision
Summation Order Value of
sum
Rel. Error Corr. Digs.Longitude First 34.4147682189941410 95.1 0Latitude First 0.67326545715332031 0.88 0Reverse Longitude First 32.302734375 89.2 0Reverse Latitude First 0.734375 1.05 0Exact Value 0.35798583924770355224609375 0 26
Table1shows the results that He & Ding got with the Fortran code shown above, on a singleprocessor, using IEEE double precision (
∼
16 decimal digits). He & Ding point out that theseresults are completely wrong — not one digit is correct. We will analyse this problem inSection3and explain why He & Ding got such inaccurate results.
1.2 The Microsoft Excel Problem
Microsoft’s Excel spreadsheet has been in use for many years and has gone though manyversions. Many millions in business, government, and universities, use some version of Excel. Most users do not have the time or ability to test the quality of Excel’s calculations,and when errors do occur most users do not see the result as erroneous. Here is an examplewhere Excel gets a wrong answer to a simple problem.
c
Derek O’Connor, February 6, 2010
2
Add a Comment
uploaded a new revision for this document (#2)