

Google Calculator Inaccuracies? - matttah
https://www.google.com/search?q=259680.68+-+37.98+-+259635.70

======
matttah
I noticed this today while doing checking some totals for a project. It seems
there is definitely something not right. I haven't seen this before.

What is also interesting is if you enter the same numbers manually into the
on-screen calculator it will give you a different answer of: 7 vs
6.99999999997

However if you update it and search for
<https://www.google.com/search?q=259680.68+-+37.98+-+259635>

and then enter the same numbers you get 7.70000000001 vs 7.69999999998

Any ideas on what is happening?

------
shenberg
decimal fractions can't necessarily be represented by a finite amount of bits
(just like the fraction 1/3 is 0.333333...). Computers work with finite
amounts of bits, so you're losing some accuracy. Other representation methods
could be used to store the numbers (e.g. store the nominator and denominator
as whole numbers), but you can't get around the fact that an infinite amount
of numbers can't be represented with a finite amount of bits (e.g. the square
root of two can't be represented accurately as a ratio).

