Google Blogoscoped

Forum

Google Calculator Fail  (View post)

Haochi [PersonRank 10]

Friday, August 22, 2008
15 years ago18,607 views

Sorry for the overused meme.

It seems that when the numbers used in a subtraction get to a certain point and their differences are small, Google Calculator will return the answer incorrectly.

http://google.com/search?q=399999999999999-399999999999998

same with other simple arithmetic calculations:
http://google.com/search?q=-399999999999999%2B399999999999998
http://google.com/search?q=399999999999999/399999999999998

Can't blame Google though, but incorrect answers are incorrect.

TOMHTML [PersonRank 10]

15 years ago #

Google is not wrong, maths are.

Martin Porcheron [PersonRank 10]

15 years ago #

The first query is a bug: Any 18 digit number minus (-) another 18 digit number seems to return 0.

The second query's result is bug of the same bug (it is effectively 399999999999998 – 399999999999999)

The third query works but 1 is returned because of rounding (the actual answer is 1.0000000000000025000000000000125 to some decimal places)

Haochi [PersonRank 10]

15 years ago #

Not being picky but JavaScript (Firefox?) does it better!!
http://img122.imageshack.us/img122/4067/wutsm0.png

alon@picitup.com [PersonRank 0]

15 years ago #

odd results, waht's the source of this bug?

Above 5 comments were made in the forum before this was blogged,

Chris [PersonRank 0]

15 years ago #

I checked other search engines, Yahoo, Ask, they are return the correct results. Google should fix this ASAP, there is no excuse for it, instead of rounding up numbers, they should use what is entered.

Observer [PersonRank 1]

15 years ago #

"waht's the source of this bug?"

fwiw, it's the expected behaviour for single precision (32-bit) floating point.

Zim [PersonRank 10]

15 years ago #

They should use Python! Numbers can get bigger and bigger and will never overflow. That's cute.

Observer [PersonRank 1]

15 years ago #

Proper support for arbitrarily large numbers requires arbitrarily large amounts of memory and CPU cycles. If you don't have that, you'll end up "doing it wrong" sooner or later. Though I admit that this probably qualifies as "too soon".

Adelvade [PersonRank 0]

15 years ago #

Awesome.

Here is my version:
   http://i219.photobucket.com/albums/cc275/AllTheLostSouls17/GoogleFail.jpg

Freiddie [PersonRank 7]

15 years ago #

Real life calculators have only 10 digit precision... (At least the real life calcs I've seen)

Google needs to use more precise system. And I don't think double-precision is enough, though.

Tony [PersonRank 0]

15 years ago #

It seems to be a floating point issue. Though why google would use floating point numbers for whole numbers is another question.

Knut [PersonRank 1]

15 years ago #

Same result for 399999999999999-400000000000000...

JESUS IS LORD [PersonRank 0]

15 years ago #

333 333 333 333 335 – 333 333 333 333 334 = 0
333 333 333 333 334 – 333 333 333 333 333 = 1

anonymous [PersonRank 0]

15 years ago #

399 999 999 999 998 – 1 = 4.0 × 10^14
via http://www.google.com/search?q=399999999999998-1

Mie [PersonRank 0]

15 years ago #

Here is the first substract that returns 0.

399999999999999-399999999999997,8=0

http://www.google.com/search?hl=es&q=399999999999999-399999999999997%2C8

Andy Wong [PersonRank 10]

15 years ago #

Floating point is easy but evil. However, it is really bad that Google programmers picked up an easy path with fault results, while the algorithm or engine for accurate results became mature 20 years ago. Google, are you listening?

Mike [PersonRank 0]

15 years ago #

Al so this is not a bug is the way of rounding and may they convert to Double instead of using Decimal..

The specs says not to use double because of the precision.

lol [PersonRank 1]

15 years ago #

399999999999999-399999999999997,7812

lol [PersonRank 1]

15 years ago #

399999999999999-399999999999997,7812

Google Calculator: 0
Microsoft Calculator: 1,2188

Bad rounding LOL

This value 399999999999997,7812 should be rounded to 399 999 999 999 997.75 not to 399999999999997,78....

haha thos are dickheads..

--- [second comment merged] ---

meaby i'm worng because i did never go to school.

Sakib [PersonRank 1]

15 years ago #

afraid to see it. Sometimes I use Google Cal. Thanks

Marc [PersonRank 0]

15 years ago #

I just use Encalc...
http://www.encalc.com/#expr=399999999999999-399999999999998
   = 1

Tom [PersonRank 0]

15 years ago #

http://www.encalc.com/#expr=39999999999999999-39999999999999998
= 0

Matt Cutts [PersonRank 10]

15 years ago #

"I checked other search engines, Yahoo, Ask, they are return the correct results."

Chris, don't speak too fast:

http://search.yahoo.com/search?p=40000000000000002-40000000000000001 returns 0

http://www.ask.com/web?&q=40000000000000000002-40000000000000000001 returns 0

http://search.live.com/results.aspx?q=40000000000000000002-40000000000000000001 returns 0

http://www.baidu.cn/s?wd=4000000000000002-4000000000000001 returns 0

What this says to me is that every search engine looked at the trade-off and ended up making the same decision as Google, which is that these sorts of queries are rarely done and that the engineering resources are better spent on other issues. But it's worth pointing out that all the engines have similar issues.

Roger Browne [PersonRank 10]

15 years ago #

It's a fair tradeoff to perform calculations using floating point, but then the answer should be displayed using floating point notation to a reasonable number of significant digits.

If the answer is presented in decimal notation, the user (naturally) will expect that the answer is correct according to the rules of decimal arithmetic.

GoogleDontCare [PersonRank 0]

15 years ago #

Read this article http://www.squarefree.com/2003/08/19/suggestions-for-google-calculator/ and see how Google did nothing in 5 years this user found these bugs and others like error catching...

ridicoluos

Pierre S [PersonRank 10]

15 years ago #

[put at-character here]Matt

Why don't you add just more Oneboxes with graphs, or instant answers for sin(x), but also other things.
I mean, asking some Googlers to keep adding more would improve usefulness and save a lot of time to many people

Matt Cutts [PersonRank 10]

15 years ago #

Pierre S, the short answer is that Oneboxes are fun to add, but they can have maintenance issues (what if the data gets stale?), and you have to think about accuracy and related issues, especially if you plan to switch to different user interfaces, data providers, etc. You also have to decide how often to trigger the Onebox, which can be a very difficult question depending on the type of user. Plus speaking personally, I don't especially want to swamp users with Google Oneboxes when other sites can provide similar information just fine.

That's why when you look at the spectrum of search engines adding Onebox-like triggers and behaviors, Google tends to be more on the conservative side of that spectrum. Take the query [how to backpack] that people got all up in arms about because a knol showed up. But if you search for [how to backpack] on Yahoo, Yahoo has hard-coded the #1 result to be a Yahoo Shortcut, and it's a definition of the word "backpack." In my opinion, that's not only bad triggering that can annoy the user, but Yahoo's shortcut isn't that useful for that query either.

Forum home

Advertisement

 
Blog  |  Forum     more >> Archive | Feed | Google's blogs | About
Advertisement

 

This site unofficially covers Google™ and more with some rights reserved. Join our forum!