Google Can't Subtract?

Aug 25, 2009 • 8:32 am | comments (3) by twitter Google+ | Filed Under Google Search Engine
 

I spotted a thread at Google Web Search Help which shows how Google can not subtract the numbers 999999999999999 - 999999999999998. Google returns the result as 0, when Yahoo and Bing return the correct result of 1.

Google: Google Calculator Wrong

Yahoo: Yahoo Calculator Right

Bing: Bing Calculator Right

Why is Google returning zero as the answer to this calculation? Is there some type of geek response to this or is Google's calculator malfunctioning?

Forum discussion at Google Web Search Help.

Previous story: Microsoft Bing Still Spamming Fake Referrers In Webmaster Log Files
 

Comments:

Mark

08/25/2009 12:51 pm

Number is too long, that is all. Same on all calculations over that size.

Darrin Ward

08/25/2009 10:40 pm

I believe this has to do with the floating point. This problem has been known for a few years and I read a really good explanation about it a while back, but I can't find it now :(

bd_

08/26/2009 06:02 pm

Google is using floating point for calculations. This is essentially scientific notation in base 2 - google really just has a value like 7450580 * 2^27 for both. The reason it has the same for both is because it had only a range of 0..2^23-1 for the significant portion of the exponent, and had to divide by 2^27 and round to get it to fit. The difference of 1 is then just lost in that rounding. Yahoo and Bing aren't immune to this either - they just use a larger floating-point type. Try 9999999999999999999 - 9999999999999999998 in all three :)

blog comments powered by Disqus