Slashdot Log In
Excel 2007 Multiplication Bug
Posted by
kdawson
on Mon Sep 24, 2007 09:37 PM
from the be-fruitful-and-all-that dept.
from the be-fruitful-and-all-that dept.
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."
Related Stories
This discussion has been archived.
No new comments can be posted.
The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
Full
Abbreviated
Hidden
Loading ... Please wait.

Microsoft just announced plans for their fix (Score:5, Funny)
Re:Microsoft just announced plans for their fix (Score:5, Funny)
Oh wait, it isn't and the bug is still at large. Sorry, jumped the gun there due to the speed at which the Open Source community usually fixes issues like this. Maybe ISO should take note.
Re:Microsoft just announced plans for their fix (Score:5, Funny)
"It looks like you're trying to multiply two numbers. I can help show you how to use the Method of Finite Differences to find a good approximation of your answer using only addition and subtraction. Would you like me to bring up a wizard so that we can get started on finding an appropriate power series?"
Re:Microsoft just announced plans for their fix (Score:5, Funny)
No, no, no... remember this is effectively Office Vista.. so the fix will be, like:
You are trying to multiply 2 numbers and the answer is 65535. This is a very dangerous multiplication frequently used in viruses... Cancel / Allow?
Re:Microsoft just announced plans for their fix (Score:5, Funny)
Windows 5: "What the hell have you done? Delete it! Delete it!"
Windows 95: "Fuck it, we have to release this steaming pile of crap now.
Just a theory...
In OOXML? (Score:5, Funny)
Looks like a typo (Score:5, Interesting)
Someone was slacking in the testing department.
Re:Looks like a typo (Score:5, Informative)
I have another theory entirely. (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 [spatula-city.org] and prnum16.asm [spatula-city.org]
--JoeRe:In OOXML? (Score:5, Funny)
to retain backward compatibility with MSDOS 16bit mode, the operands of any multiplication that may exceeds a 16 bit boundary must be converted to farsi and multiplied using an abacus emulator, as per sec (II)par alpha comma 2; the result may or may not appear in Windows Genuine Octal Format (a.k.a. fake octal - that is octal without the leading zero and minus 1) for added convenience of EndUser(tm).
Re:In OOXML? (Score:5, Insightful)
Re:Wow... (Score:5, Insightful)
Re:Wow... (Score:5, Funny)
Pentiums (Score:5, Funny)
Re:Pentiums (Score:5, Funny)
Re:Pentiums (Score:5, Funny)
Is anyone using Excel 2007? (Score:5, Insightful)
Re:Is anyone using Excel 2007? (Score:5, Funny)
The renewal form, hmmm? (Score:5, Funny)
Who are you going to call? (Score:5, Funny)
Give em a break, even the Count from Sesame Street cant count that high.
Re:Who are you going to call? (Score:5, Funny)
Ghostbusters?
Re:Who are you going to call? (Score:5, Funny)
But I think the Count can manage to count to six without stuttering.
Re:Who are you going to call? (Score:5, Funny)
Re:Who are you going to call? (Score:5, Funny)
1... 2... 3... 4... 5... 5 Mod points for Halcyon! {thunderbolt, lightning, kid-friendly-maniacal laughter}
It only gets worse. (Score:5, Funny)
Re:It only gets worse. (Score:5, Funny)
What's your point?
Re:It only gets worse. (Score:5, Funny)
I can see the OOXML tag now... (Score:5, Funny)
=850*77.1
</MultiplyLikeExcel2007>
Re:I can see the OOXML tag now... (Score:5, Insightful)
Lets wait and see
Re:I can see the OOXML tag now... (Score:5, Funny)
Lets wait and see
Unnecessary abstraction (Score:5, Funny)
Re:Unnecessary abstraction (Score:5, Funny)
some limited testing (Score:5, Interesting)
425 154.2 100000
212.5 308.4 100000
8500 7.71 100000
but this evaluates correctly..
25 2621.4 65535
so it's not every multiplication that evaluates to 65535
I'm using Excel 2007 12.0.6024.5000
Imperiled by binary decimals? (Score:5, Interesting)
Clearly the error is weirdly subtle, if 5.1*12850 gives the bugged behavior, but 8.5*7710 works just fine. In fact, I verified that all permutations of a bugged combination =A*B of the form =A/2*B*2 are bugged. Further...all of the buggy decimal values have no perfect floating point binary representation. 77.1 has an infinite binary expansion using IEE 754, while 8.5 has an exact representation. It seems likely that they are only using their BCD format (or whatever) when binary floating (or fixed) point just won't cut it, but then their internal->decimal conversion code chokes on 2^16 for some reason, while the binary (whether it is floating or fixed point) conversion works just fine (possibly because it doesn't have a boundary at 2^16--maybe it has its own threshold bugs
What happened to the beta tests?! (Score:5, Insightful)
For that matter, they probably assign people to create scripts to randomly create calculations and test the results. However, after reading a bit of the Usenet thread, automated scripts might not have caught the problem, it seems that it is at the rendering layer - using VB to get the cell value apparently gets the correct value.
Weird. And highly embarrassing.
I can't wait for the advertisements from OpenOffice (and it's new allies in IBM and Google) to play this up! Apple will have a field day too -- "Hi, I'm a Mac. Sure I'm good at video and music and all that fun stuff, but I can also do math. I know that 65,535 doesn't equal 100,000." -- OK, maybe that wouldn't be TV worthy, but I'll make a good web ad for Slashdot et. al.
This is why OOo Calc can never replace Excel (Score:5, Funny)
This is yet another example of where Calc fails utterly to be compatible with Excel. How can I use Calc if I can't be sure that it will produce the same answers that my boss gets with Excel?
All those open source developers just don't get it. Geeks that they are, they prize accuracy over consistency and uniformity. The clueless dweebs need to get out of their parents' basements and get a clue about how the REAL WORLD works. Nobody gets promoted for contradicting their boss, duh.
Nope, until Calc can faithfully reproduce every Excel calculation, it simply won't be ready for use in the real world.
Step 2 Found! (Score:5, Funny)
Re:Oh no! (Score:5, Insightful)
Re:Oh no! (Score:5, Funny)
News at 11
Re:Oh no! (Score:5, Informative)
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.
Re:obviously malicious (Score:5, Insightful)
Re:obviously malicious (Score:5, Insightful)
Re:Good Luck! (Score:5, Insightful)
What are the odds of that bug only affecting that number? It's a symptom that the underlying routine is totally fscked, in ways that could cause nasty surprises.
If it gave the wrong answer all the time you'd know it was crap and would just ignore the whole thing. It's when it only gives wrong answers some of the time that can lead you into a false sense of confidence.
You've also got to wonder, if it worked fine in previous versions of Excel, what the frack they were messing with to hose it up. It's not like somebody changed the rules of arithmetic recently, did they?
Re:Good Luck! (Score:5, Insightful)
I'm not the only one that recognised this as the 16bit number (see some of the other posts in this thread).
I'd wager a fair amount of money to say that numbers under 65535 are represented as 16 bit ints but anything over that number is changed on the backend to possibly a 32bit number. This allows faster calculations of smaller numbers (which happen quite a lot) while still allowing higher numbers to be used. The developers created this system, but forgot to test the edge cases (though it can be argued that they don't test any cases before release). If it were to happen to any other number, it would either be at the 8 bit number (though I doubt it) or at the 32/64 bit number they use for the larger values.
Re:Good Luck! (Score:5, Insightful)
"No it doesn't really affect anything. "
Oh, it's only the largest unsigned 16 bit number and comes up in a crapload of places. Enough times that you should have _memorized_ it by now.
Jeez. Please turn in your geek card NOW.
--
BMO
Re:Good Luck! (Score:5, Insightful)
spreadsheets have their place.
Just about every engineer I know (and yes, IAAE)uses Excel for calculations with no issues at all. Yes they use more specialised (and expensive) tools for things like Finite Element analysis (ie bridges, etc.) and so on, but a lot of everyday stuff gets done on spreadsheets.
Everything from hydraulic calculations to reinforcing quantities can be done in a spreadsheet.
However it would be a mistake to rely solely on results produced by any software without using some judgement on the results. Problems come when people get too trusting of software, whether its a spreadsheet or a $20,000 Analysis package.
Mind you, none of the engineers I know are using Excel 2007 yet, and aren't likely to while this sort of problem is out there.
Re:Dunno... (Score:5, Funny)
What, lxvDXXXV?
(And yes, what have the Romans ever done for us, apart from apparently producing correctly functioning spreadsheet software?)
Re:But the important question is.. (Score:5, Funny)
As long as you stay below 65535 feet.
Re:So? (Score:5, Funny)
Just remember Micro$oft knows best... move along, nothing to see here.
Re:Check a C multiply on that machine... (Score:5, Insightful)