Slashdot Mirror


Excel 2007 Multiplication Bug

tibbar66 writes with news of a serious multiplication bug in Excel 2007, which has been reported to the company. The example that first came to light is =850*77.1 — which gives a result of 100,000 instead of the correct 65,535. It seems that any formula that should evaluate to 65,535 will act strangely. One poster in the forum noted these behaviors: "Suppose the formula is in A1. =A1+1 returns 100,001, which appears to show the formula is in fact 100,000... =A1*2 returns 131,070, as if A1 had 65,535 (which it should have been). =A1*1 keeps it at 100,000. =A1-1 returns 65,534. =A1/1 is still 100,000. =A1/2 returns 32767.5."

11 of 806 comments (clear)

  1. Yes. by oatworm · · Score: 3, Informative

    Yep - my office switched to Vista and Office 2007. Then again, we're a networking firm, so it's in our best interests to use stuff while it's still "beta" so we know the bugs and quirks before our customers start playing with it.

    As an aside, when I went to pick up a lease renewal form for my apartment complex, I noticed that the lady at the front counter was also running Office 2007, so I'd say it's out there - just not exceptionally widespread at the moment, compared to other versions of Office.

  2. Re:some limited testing by indaba · · Score: 3, Informative

    =(8500 * 1) * 7.71
    that evaluates to 65535

    but :
    =850*(771/10) evaluates to 100000

  3. Re:Oh no! by ozmanjusri · · Score: 5, Informative
    This is the most devastating bug in years.

    It could be for Excel users.

    65535 is common in computing because it's the highest number which can be represented by an unsigned 16 bit binary. If Excel is mishandling it somewhere in the background, chances are that failure will show up at multiple points.

    If I had an important Excel 2007 spreadsheet, I'd be loading it up in OOo Calc or an older version of Excel now.

    --
    "I've got more toys than Teruhisa Kitahara."
  4. Re:Looks like a typo by Firehed · · Score: 4, Informative

    Wouldn't that apply to 65,536, rather than 65,535? 65,535 is 0xFFFF, not 0x10000.

    --
    How are sites slashdotted when nobody reads TFAs?
  5. I have another theory entirely. by Mr+Z · · Score: 5, Informative

    ...except for the minor detail that 65535 is 0xFFFF... :-)

    That said, my 32-bit print routine for a 16-bit CPU actually works by printing two 16 bit numbers, with a slight hack to the 16-bit routine to allow it to print numbers in the range 65536 - 99999 for the lower 5 digits. It does this by dividing the 32-bit number by, you guessed it, 100000. It then prints the quotient and the remainder. It has to do some extra legwork, though, to get the leading zeros right across the two words, and I think it's there that the code went south if they're using a technique similar to mine.

    I'm guessing what happened here is that there's an off-by-1 error in a comparison somewhere (i.e. ">= 65535" instead of "> 65535"), and the 32-bit quotient/remainder print routine kicks in. Since the number is already smaller than 100000, it probably hits a fall-thru case where the quotient is assumed to be 1, and there's no remainder, hence it printing 100000.

    For reference, here's that assembly code I mentioned: prnum32.asm and prnum16.asm

    --Joe
    1. Re:I have another theory entirely. by imdx80 · · Score: 3, Informative

      Debug.Print Application.Cells(1, 1).Text
      Debug.Print Application.Cells(1, 1).Value

      where the formula is in cell A1. You get the correct & incorrect results depending on whether you look at value or text

  6. And yet it works FINE when you GRAPH it... by uptownguy · · Score: 5, Informative

    ....interesting twist...

    I just fired up Excel and created a simple graph:

    One column of numbers was a series from 845-855. The next column was the first column * 77.1. As expected, the series jumped from:

    65149.5, 65226.6, 65303.7, 65457.9, 100000, 65612.1, 65689.2, 65766.3...

    But then when I created a graph to display this, I had a simple straight line -- trying to plot the single data point represented by "100000" also displayed the accurate number. Any other calculations done with this number yielded the right result, too. Taking the value of the cell that displays100000 and multiplying it by 2 results in 131070.

    So all things considered, this really amounts to an Easter Egg. Most spreadsheets will calculate, graph, and function exactly as they should even using the results from a cell that displays inaccurately in that one case...

    --


    I would have to say that explosives are the most abused technology in all of history.
    1. Re:And yet it works FINE when you GRAPH it... by fruity_pebbles · · Score: 4, Informative

      That's true, but if you add 1 to that result you get 65537. And dividing either "1000000" or "100001" by 2 gives the correct results. I can replicate the problem as a display problem, but I can't produce any actual calculation errors.

  7. Re:In OOXML? by Frankie70 · · Score: 4, Informative

    Welcome to the world of Floating point arithmetic.

    Look at these articles.

    http://support.microsoft.com/kb/q78113/
    http://c-faq.com/fp/printfprec.html
    http://c-faq.com/fp/fpequal.html

    Microsoft Excel was designed around the IEEE 754 specification with respect to storing and calculating floating-point numbers.

  8. Re:Microsoft just announced plans for their fix by FelixGordon · · Score: 4, Informative

    It looks more like the result of an overflow error at some stage of the calculation, since 65535 is the maximum value an unsigned 16 bit integer can hold.

  9. The reason it was named "Windows 95" by Solandri · · Score: 3, Informative

    For those who don't remember, the reason for the "95" name was likely because Windows "Chicago" kept getting delayed. Eventually Gates announced it was going to be released under the name "Windows 95". Speculation was that the name was chosen to pressure the development team to get it released in 1995 instead of letting it slip to 1996. They released it in late summer 1995, arguably too soon.