Microsoft has been selling their Windows operating systems ever since 1993. That’s a good lord 17 long years. They have had more than eight different versions of Windows OS in those 17 years, and all of them were aimed to do simple & complex computing.

One such tool aimed to help us carry out simple computing is the Windows calculator. As with the OS itself, Windows calculator app has also undergone changes over the years and in the latest Windows 7, it is prettier than ever before. But there are few things which are left unchanged – Windows Calculator bugs!

Windows calculator bug -> 2-2 != 0

Trust me, if you haven’t come across this bug before, you will surely have a hearty laugh. Open the Windows calculator and find out the square root of 4. It gives the right answer (which is 2). Now subtract that with 2. Lo and behold! The answer is not 0 but -1.068281969439142e-19. You don’t trust me? Check it out yourself! Or check out the video below!

The funny thing is, in Windows XP, the result used to be -8.1648465955514287168521180122928e-39. So they have surely tried their best to come near zero πŸ˜‰

Someone has registered the bug under MS connect, but no one from the team has bothered to address it yet!

Also Read:

Raju is the founder-editor of Technology Personalized. A proud geek and an Internet freak, who is also a social networking enthusiast. You can follow him on Facebook and on Twitter. Mail Raju PP. Follow rajupp


17 thoughts on “Holy Cow! Microsoft Doesn’t Know Simple Maths

      • Ultimate 32-bit but I do not use XP mode. Now I understand why. I was using scientific view. If using standard view, you’ll get -1.068281969439142e-19. Very weird.

  1. There must be any kind of limitation else company like microsoft and their competent engineers must have resolved the same.

  2. All computing machines represent numbers to a finite level of accuracy (with the exception of symbolic computation programs). As a general example, 1/3 is represented as 0.3333333333333333333 (with a finite number of threes). Generally however, the systems keep about 2 more decimal places than what is shown to the end user since the machine and software designers know that there is an error involved. These two spare decimal places are rounded off before the result is shown the user. If you calculate ((1/3)*3)-1, there’s again an error, but this time it is small enough such that rounding off answer fixes the error.

    Sqrt(4) too has some error, which gets rounded off to become 2 when “shown” to the user. When you subtract two from it, the real error in Sqrt(4) shows up.

    This “bug” is not in Windows. It’s everywhere. In every digital calculator. In your computer’s processor itself also. I cannot make claims about Windows Calculator, but a calculator program in general would just use the instructions available in the processor to compute this stuff.

    This bug is avoided only by “symbolic” computation programs like Mathematica. They do not store 1/3 as 0.33333333333333, but as 1/3 itself. Thus (1/3)*3 is computed to be exactly 1 without actually computing (1/3) at all.

    • fair enough! but the thing is, sqrt(4) + 2 gives 4, now how is that the addition works and subtraction doesn’t? I have a feeling your analysis is flawed.

      Edit: I also cross checked on couple of online calculators and they work fine. So the bug seems to be restricted to Windows alone.

      • >> how is that the addition works and subtraction doesn’t

        Very simple.
        Say the machine is capable of calculating to 10 digits but shows you only 8.

        Now 4.0000001 remains 4.0000001 since its less than 8 digits.
        Note that 400.00001 would be represented internally as 4.0000001e2, so it still gas 8 digits in the base (aka characteristic).
        4.000000001, which has 10 digits, is shown as 4.0000000 which becomes just 4.
        But 0.000000001 becomes 1e-9, which has only 1 digit place without considering the exponent (more precisely, mantissa). This is why the system does not round it to zero.

        This is how same delta of error shows up when the result of the calculation is zero. Answer being zero makes the system shift the decimal point and adjust the exponent instead. This causes the number of digits in the base to become smaller. And then rounding does not fix it anymore.

        As far as mantissa goes, a modern computer allows that to go from +300. See more here:

        Some alternative calculators may be hiding a different number of decimal places, so may behave differently from Windows. Generally, for all calculators, it is possible to find some calculation where the result is wrong. With the exception of symbolic calculators that is. A calculator that keeps 1/3 as 1/3 (like my hand-calculator can) instead of storing it as 0.333333333, can give accurate results.

        Try the following ones with different calculators. Correct answer is zero in all cases.
        Sin (pi)
        Sin (pi) minus zero.
        And so on…

        • I agree to what you say Alok, but is there any specific reason for it being restricted to Windows only??
          I have never even once encountered any such errors. These calculators are capable of handling such round-offs. Only in this case it doesn’t.

          • Tell me about one calculator that you think does not have this “type” of issues. If I have access to it, I’ll show you some calculation what should yield zero for an answer but won’t. (As I mentioned, symbolic computation is a different case).

            I just did computed (sqrt(pi))^2-pi with my hand calculator, and the answer was not zero.

  3. Alok is right. All flating-point calculation (and sqrt is always such a case) will have a certain error margin. This is due to the fact that we use limited info to represent sets of numbers that, in essence, require infinite storage to be represented.

    Besides, the -8e-39 error margin is way smaller than -1e-19 . You should look first at the exponent (-39 is way smaller than -19) to compare the values. This shows that when in scientific mode the calculator uses more bits to represent numbers.

Leave a Reply

Your email address will not be published. Required fields are marked *