Thursday, 30 January 2014

Fun and games with Windows Calculator

In Microsoft Windows, there are a bunch of default applications, one of which is Calculator. A fairly standard application that I just discovered something interesting about today. A picture of the application from Win 7 is below.



As computers only really know two numbers (1 and 0), there is interesting work that happens in the background when trying to deal with complex math. Take for example the following scenario:

  • 3 x 3 = 9, also known as the square of 3 is 9.
  • Conversely, sqrt(9) = 3 (i.e. the square root of 9 is 3).
  • Hence the expectation is: sqrt(9) - 3 = 0.
Try that on Windows Calculator, and you'll get a very interesting result. Calculator is reporting a very small number, but it isn't actually quite zero.

Also if you use different numbers, e.g. sqrt(16) - 4, and so on, you'll get slight variances in the result.

The math behind why this is so, is discussed more here: http://social.technet.microsoft.com/Forums/windows/en-US/79124007-4127-4d50-a182-f91bde71e0fe/issue-in-calculator?forum=w8itprogeneral

No comments:

Post a Comment