Google's math == FAIL!

Google's calculator has some trouble handling math with some large numbers, an issue that's not unheard of in computing circles but that might not sit well at a supremely nerdy company that's named after a humongous number.

Google's calculator has troubles with some large numbers. (Credit: Google)

The errors appear, though not consistently, with some very large numbers. For example, 2,999,999,999,999,999 minus 2,999,999,999,999,998 should be 1, but Google calculator shows it as 0.

It's not a simple case of a cutoff where things fall apart, though. 1,999,999,999,999,999 minus 1,999,999,999,999,995 incorrectly equals 0, but 1,999,999,999,999,999 minus 1,999,999,999,999,993 correctly equals 6. And 400,000,000,000,002 minus 400,000,000,000,001 incorrectly equals 0, but 400,000,000,000,002 minus 400,000,000,000,000 correctly equals 2.

Perhaps most amusing for the schadenfreude crowd, Google botches some math involving a googol, which is 1 followed by 100 zeros. The quantity of a googol plus one, minus a googol, equals 0 rather than the correct result, 1.

Cutting Google some slack

To be sure, math is difficult at this scale, where special methods for encoding numbers must be used if fine precision is to be maintained. Happily for those building calculators, though, it's a relatively unusual requirement in the real world: when measuring numbers on the magnitude of the distances between stars, it's rare that precision of a few centimeters can be obtained. And it's also rare that such precision actually is relevant.

Big numbers are often expressed with a two-part floating-point format, with some small number (the mantissa) multiplied by 10 to some power (the exponent). For example, Google's revenue in the second quarter was $1.25 billion, which also can be expressed as $1,250,000,000, or as $1.25 times 10 to the power of 9, or as $1.25 x 10^9. Floating-point math is good at spanning vast ranges of numbers, but typically the first component only keeps track of limited number of digits, so the small change falls by the wayside.

Precise math on computers is compounded by the fact that computers typically work in binary math, with digits of only 0 or 1, whereas people operate in decimal math, with digits running from 0 through 9. Accuracy is compromised when computers convert numbers into binary for processing, then back to base 10 to show us the results.

Indeed, even with decades of computing technology already under our belts, it wasn't until IBM's latest flagship Power6 processor that even Big Blue could do actual decimal math without converting into binary and back.

Ordinary calculators quickly run out of steam when trying to deal with large numbers. Sure, Google may have some issues, but most handheld calculators don't even let you type the number 1,999,999,999,999,993 much less do some mathematical operation on it. And there's not a big market for software such as Wolfram Research's Mathematica that can get the math right.

Google acknowledged its math is imperfect. "We are aware that the calculator tool in Google Web search is not working properly for certain calculations, and we are looking into this problem further. We apologize for any problems that this causes our users," the company said in a statement.

So big math is deceptively difficult. Should Google be forgiven for shortchanging us a bit when it comes to significant digits?

No, Google should do better

Nah. Any company that named itself after a big number must be held to a higher standard.

It might slow down calculations fractionally if Google had to detect when a large but high-precision number was involved, then send that calculation to a different server equipped with a more advanced math algorithm. And Google is rightly focused on server response, since users search more when the search engine is faster. But this issue is part of Google's core culture and image. Google muffing the math is like a politician wrapping himself in a flag that's got an extra couple stars.

After all, this is the company that decided to raise $2,718,281,828 billion in its IPO, a reference to "e," the base of natural logarithms, and that invited job applicants who could solve a math puzzle.

Ideally, Google could fix the algorithm. That's what Microsoft did with a recent Excel math problem and Intel did — at great expense — with the notorious FDIV bug that afflicted some Pentium processors in the 1990s.

Others have found limits with Google's calculator. For example, 2.00135558564^1023 is interpreted by Google's calculator as 1.79769313 x 10^308. But increase that number by one eensy little amount to 2.00135558565^1023, and Google interprets it as a search, not a math problem.

Which leads me to my final thought. In that last example, Google punts on the math and shows a mere search result, which isn't likely to lead anyone astray. It's what's called a graceful failure mode. It's better to show no results than bad results. That's especially important given that the very calculations where people would use a calculator are the very ones where, unlike the examples above, people aren't going to notice an error.

(Via Google Blogoscoped.)

Like this article? Click below to send it to your mobile for free!

Talkback 4 comments

  1. Don't forget the number of decimal places Anonymous -- 26/08/08

    Being the slightly obsessive compulsive guy I am, I have an excel spreadsheet set up to calculate my fortnightly home loan repayments. This helps me work out ahead of time what interest rate increases do to my repayments as well as when exactly I’ll have it paid off (21 years, 1 month and 23 days). Anyway... every now and again I have to add 1 cent or subtract 1 cent off the balance in order for it to tally with what my statement says. The reason? The bank calculates my balance to a different number of decimal places than excel. Which then got me thinking about how much processing power it takes the banks to work out an interest rate change?? Looks like I should be thankful they’re not using Google though – or should I...

  2. Big Blue can't do math F.J. Banduhn -- 29/08/08

    Actually IBM's 1620, a decimal machine, could do "unlimited" (until it ran out of memory) precision arithmetic

  3. Large Numbers ARE Hard Justin Marrese -- 30/08/08

    "raise $2,718,281,828 billion in its IPO"

    That's over $2.7 quintillion dollars! Perhaps they're very good with large numbers and it's the rest of us who don't understand ...

  4. does Author == Fail? Aleks -- 02/09/08

    Dear Author,
    are you aware that == is an equality operator and = is an assignment operator in many prominent programming languages such as C++ and Java. So, are you asking us, the readers, if Google Math is failing or are you making a statement that Google Math deserves a failing grade? According to you, it is the latter. You suggested that Google should’ve gracefully exited rather than providing us with a bad answer. [Logic error #1…don’t feel bad. Many 1st year programming students make this one. Fix: Drop the ‘=’.]
    Let me continue. $2,718,281,828 billion is the amount Google raised? This is another logic error [Logic Error #2] in your article. I bet you meant to say, $2. 718 281 828 billion rather than what you wrote. [Fix: Drop the commas and put a decimal point or drop the word ‘billion’.] Somehow, I don’t believe the combined economies of the entire planet Earth come close to the number you have suggested. Should YOU do better? Yes. Should Google do better? Absolutely. We all make mistakes but do we all fix them?

Add your opinion


Sponsored content

Power Centre - Content from our premier sponsors

Blogs

  • Alex Serpo Will the NSW Govt put Linux in schools?
    The NSW Government's release this week of an expressions of interest tender to give low-cost laptops to every senior public school student in NSW is a big step, but will these systems be Windows or Linux?
  • Array Naked Mac versus protected PC: What wins?
    What's easier to manage — 200 Mac OS X systems without antivirus or 200 Windows systems running a leading antivirus package?
  • Array Dear Telstra: pack up your toys, go home
    Rejecting Telstra's proposal, after all, is the only conclusion Conroy can reach: as someone whose entire philosophy is built around transparency and process, he simply cannot keep Telstra as part of the NBN bidding process anymore.
  • More blogs »

Tags

Back to top

Featured