Wikipedia:Reference desk/Archives/Computing/2018 May 17

= May 17 =

Suggestions for extracting data from a damaged Excel file?
Hello all. I have an Excel file that I put a lot of work into and it's damaged. I saved it recently and when I went back to work on it, it's name had changed to have this in front of the original file name: ~$. when I try to open it, Excel says: "Excel cannot open this file. The file might have been damaged or modified from its original format". I was just wondering if there's anything anyone might suggest I try to extract the data from the file. I am very far from a computer wiz. It's not the end of the world, but losing it is a lot of work down the drain. At the same time, it contains sensitive information, and I would not want to send it to an expert to open it. So if anyone has some spoonfed instructions... I am on an IMac running High Sierra. Thanks!--185.230.124.52 (talk) 03:36, 17 May 2018 (UTC)


 * Someone else probably has a better answer, but what format is it in? XLS?  Bubba73 You talkin' to me? 04:19, 17 May 2018 (UTC)
 * It's xlsx.--67.244.114.239 (talk) 04:30, 17 May 2018 (UTC)


 * The ~$ at the front means that this is a temporary file resulting from an improper closedown of Excel (or the operating system). I assume that you've checked that there is not also the original filename somewhere.  (Also check that you are not still running another copy of Excel.)   Dbfirs  07:45, 17 May 2018 (UTC)

PAIRWISE SUMMATION
PAIRWISE SUMMATIONS I do a lot of computations, mostly in complex numbers. That includes multiplications and additions. Rounding errors accumulate and eventually become a problem. I found this article in Wikipedia but it gives a pseudocode  instead of C or C++ and it seems some information is missing.

I quote:

In pseudocode, the pairwise summation algorithm for an array x of length n > 0 can be written:

s = pairwise(x[1&hellip;n]) if n &le; N                   base case: naive summation for a sufficiently small array s = x[1] for i = 2 to n s = s + x[i] else                       divide and conquer: recursively sum two halves of the array m = floor(n / 2) s = pairwise(x[1&hellip;m]) + pairwise(x[m+1&hellip;n]) endif

What is clear so far that the algorithm is recursive because the function calls upon itself, and then the input is an array of reals but I mostly operate with complex numbers. So, this is my thought on how it could be implemented in C, my OS is Linux Ubuntu:

dcomp is my definition of double complex. Suppose I have an array of 100 complex numbers to add, my typical situation. I expect to get one complex number in the end.

I am not sure this code in this form will work. First, N is undefined. Obviously, N is an integer. Any hunch as to its possible value? My hunch is that iT is something like $$N << n$$, but how is it defined? Also is it a number that changes during iterations? I must make this code work. I do have considerable loss of precision in my computations of significant practical value. I will appreciate any comments to improve the code. Thanks, - AboutFace 22 (talk) 16:16, 17 May 2018 (UTC)


 * The pseudocode clearly states that N is small enough to make "a sufficiently small array". The point is that you have to have a point at which you don't make a recursive call. You start adding. How small of an array do you think you need to be sure that you won't have rounding errors? That is how small N needs to be. Example: N=5. Then, when the array has 5 (or less) elements, you will just add them together and not perform a recursive call. 209.149.113.5 (talk) 18:56, 17 May 2018 (UTC)

Thank you. It makes sense. I will follow it, although it is unclear how it operates. I will think about it too. AboutFace 22 (talk) 22:28, 17 May 2018 (UTC)


 * You might also be interested in Kahan summation algorithm. Dmcq (talk) 22:57, 17 May 2018 (UTC)

I am familiar with it but it's considered much slower than pairwise and only slightly better in avoiding rounding errors. AboutFace 22 (talk) 19:45, 18 May 2018 (UTC)