Updated at 7 p.m. PDT with Google comment.
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.
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,, 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. 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 FDIV bug that afflicted some Pentium processors in the 1990s.and Intel did--at great expense--with the notorious
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.)