Google Blogoscoped

Forum

Google Calculator Fail  (View post)

Haochi [PersonRank 10]

Friday, August 22, 2008
11 years ago16,825 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.

google.com/search?q=3999999999 ...

same with other simple arithmetic calculations:
google.com/search?q=-399999999 ...
google.com/search?q=3999999999 ...

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

TOMHTML [PersonRank 10]

11 years ago #

Google is not wrong, maths are.

Martin Porcheron [PersonRank 10]

11 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]

11 years ago #

Not being picky but JavaScript (Firefox?) does it better!!


img122.imageshack.us/img122/40 ...

alon@picitup.com [PersonRank 0]

11 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]

11 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]

11 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]

11 years ago #

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

Observer [PersonRank 1]

11 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]

11 years ago #

Awesome.

Here is my version:
  


i219.photobucket.com/albums/cc ...

Freiddie [PersonRank 7]

11 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]

11 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]

11 years ago #

Same result for 399999999999999-400000000000000...

JESUS IS LORD [PersonRank 0]

11 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]

11 years ago #

399 999 999 999 998 – 1 = 4.0 × 10^14
via google.com/search?q=3999999999 ...

Mie [PersonRank 0]

11 years ago #

Here is the first substract that returns 0.

399999999999999-399999999999997,8=0

google.com/search?hl=es&q= ...

Andy Wong [PersonRank 10]

11 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]

11 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]

11 years ago #

399999999999999-399999999999997,7812

lol [PersonRank 1]

11 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]

11 years ago #

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

Marc [PersonRank 0]

11 years ago #

I just use Encalc...
encalc.com/#expr=3999999999999 ...
   = 1

Tom [PersonRank 0]

11 years ago #

encalc.com/#expr=3999999999999 ...
= 0

Matt Cutts [PersonRank 10]

11 years ago #

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

Chris, don't speak too fast:

search.yahoo.com/search?p=4000 ... returns 0

ask.com/web?&q=40000000000 ... returns 0

search.live.com/results.aspx?q ... returns 0

baidu.cn/s?wd=4000000000000002 ... 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]

11 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]

11 years ago #

Read this article squarefree.com/2003/08/19/sugg ... and see how Google did nothing in 5 years this user found these bugs and others like error catching...

ridicoluos

Pierre S [PersonRank 10]

11 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]

11 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.

This thread is locked as it's old... but you can create a new thread in the forum. 

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!