• After 15+ years, we've made a big change: Android Forums is now Early Bird Club. Learn more here.

Calculator Error

Quote:
Originally Posted by empyreandance
No, a product of a math degree. First of all, don't appreciate the condescending attitude. Second, I would be more than happy to show you the fault in your logic.
I double dog dare you to prove me wrong. But by PM, so this doesn't clog the thread. though you should come back here to admit it when you realize you're wrong.

So who won? :)

Also, 684.56 - 676.29 = 8.2699999999999999999999999 on my Thunderbolt. Wish they would fix this problem. This is clearly a glitch
 
Upvote 0
Not quite a calculator error but a throwback from floating point arithmetic. This is particularly common with computations in programming, e.g., you do not test for equality to zero but rather test for proximity to machine-epsilon: abs(x)<eps.

That's correct. The problem is that certain values that are precise in decimal don't have any precise representation in binary (which computers generally use for arithmetic) so tiny errors can accumulate. Most calculators round the value slightly when displaying results, so even if they calculated an actual value of .799999, they might display a result of .8 to make the human happier.

For example, the value of one tenth is represented as:

  • Decimal: 0.1
  • Binary: 0.0001100110011001100110011001100 ...

Some calculator programs use decimal arithmetic to get around the problems that users tend to see (I think the MS-Windows calculator was rewritten in decimal not too many years ago), but sometimes the decimal support libraries aren't available to developers or don't support advanced features like transcendental functions.
 
Upvote 0
Wow, only took a year and a few months before the true explanation came out.

For the record:

Keyzer was correct in his proof. And analogous proof is to look at the limit of the number denoted by x=7.999999...repeating - for every digit 9 you pick in the decimal part of the number I can find another 9 that adds 9/10 of that digit you just picked. If, for example, you just picked the 4th 9 (meaning 9/10000) I can find the fifth 9 with adds {(9/10)*(1/10000)}, or 9/100000 to the value. And so forth and so on - ad infinitum, ad nauseum (Let's see who jumps on me for those lol).

Another proof:

1/3 = .3333... repeating.
3 * (1/3) = 1.
But, 3 *.3333... repeating = .9999... repeating.
If you use algebra to solve this, and discount quantum mechanics or whatever other BS you want to throw into here, you get the following:

X = 1/3 = .3333.... repeating
3X = 1 = .9999... repeating
Let 3X = Y.
Then, Y = 1 = .9999.... repeating.
If you argue that .9999.... repeating != 1 then you're saying Y != Y.

Therefore, 1 is equivalent to .9 repeating.

The key here, though, is that you state it's equivalence - they are not equal, they never will be, but for all intents and purposes they are equivalent (A very different word than equal).

Now, on to the explanation as to why this is happening - the Android calculator is just that - a calculator. It is not programmed to fix common errors that are associated with binary decimal operations as noted by BlueBiker. To read his Binary decimal, you get the following:

(2^0*0)+(2^-1*0)+(2^-2*0)+(2^-3*0)+(2^-4*1)+... etc. So, to achieve .1 you take and add 1/16 + 1/32 + 1/256 + 1/512 + ...which will never actually give you .1, but will come so very close - in the form of .09999... repeating.

FWIW - I'm only making the logic easier to understand. Keyzer, ubergrey and BB were spot on. to begin with.
 
Upvote 0

BEST TECH IN 2023

We've been tracking upcoming products and ranking the best tech since 2007. Thanks for trusting our opinion: we get rewarded through affiliate links that earn us a commission and we invite you to learn more about us.

Smartphones