Microsoft Windows Calculator Bug, Sqrt(4) – 2 != 0

Yesterday we posted about a bug found in Windows 8:

Windows 8 Taskbar Context Menu Bug

And now its turn of Windows Calculator. Almost all Windows users use the default Calculator application which comes preinstalled with Windows OS. But did you know it contains a bug which has not been fixed by Microsoft yet. This bug exists in almost all Windows versions including Windows XP, Vista, 7 and Windows 8.

The bug appears when you try to calculate following:


If you can't understand the above mentioned equation, lets describe it in details. The above command first calculates Square root of 4 and then subtracts 2 from the result.

Square root of 4 is 2 and when we subtract 2 from it, the end result should be 2-2=0 but Calculator shows a long series of numbers in the result.

If you use the Standard mode of Calculator, the result would be displayed as -1.068281969439142e-19 and if you use Scientific mode, you'll get the result as -8.1648465955514287168521180122928e-39 as shown in following screenshot:


Its definitely a bug in Calculator. You might get different result in different Windows versions but the result will never be correct i.e. 0.

Following video shows the bug live in action:

The only reason behind this bug which I can figure out might be the way computer calculates square root. The square root of 4 is calculated as 1.9999..... up to infinite by computer and it shows the result as 2 using the round off mechanism. And when we subtract 2 from the result, it actually subtracts it from 1.9999..... up to infinite and shows the big series of numbers in minus.

Anyway after all the facts or assumptions, its definitely a bug similar to Notepad bug which also exists in all Windows versions:

Notepad Statusbar Bug Found in All Windows Versions

Thanks to our reader "Anish Mehta" for sharing this bug...

Share this article: Facebook | Twitter | Google+ | Reddit | Tell a friend

Posted in: Windows 7, Windows 8 / 8.1, Windows Vista, Windows XP

Other similar articles that may interest you


  • Not only this, (root of 16)-4 also not equal to 0 ;)

  • VG

    ^^ Absolutely. It seems the bug only appears when the number to be subtracted is equal to the resulting number.

  • It's a round problem for sure, if you calculate int(sqrt(4))-2 the result will be zero.

  • There's a typo in the article: "Its definitely a bug in Calculator. You might get different result in different Windows versions but the result will never we correct i.e. 0.", it should be "never be correct".

    Other than that, interesting find.

  • Even with parntheses, it doesn't get it right.

  • But 1.9999999... to infinity is equal to two. That should make no difference, so there must be another explanation.

  • sqrt(2)- sqrt(2) shows a perfect zero, hence there cannot be any bug

  • My maths is

  • I get the same bug in the default Windows Phone calculator too. Haha.

  • Faced exactly the same thing in Windows 8 CP 64-bit. Great find. :D

  • I know this bug is firstly seen in Youtube Video, User Name: wizaryan

  • Knew it long ago. Saw some "Windows XP Tricks" video, and XP showed like -2.042 etc. BTW, that was SP2. SP3 is same as Win7.

  • -8.1648465955514287168521180122928e-39 is another way to write -0.0000000000000000000000000000000000000081648465955514287168521180122928.
    THIRTY-NINE zeros! I'd say that that's accurate enough for most cases.

  • It's not really a bug.
    The calculator uses float data-type to manage the values. So, the numbers that "never ends" are never exact. The reason why it uses floats, is for efficiency. This "bug" exists in many advance calculators that you buy at the store, and under Windows, it existed possibly well before Windows 95.

    IBM has a page on

  • The "bug" also appears in the calculator of Windows XP, which is a pretty lousy trig calculator - it has *NO* square root, sin, cos, etc. buttons. To compute the square root of a value you have to raise to a decimal- fraction exponent:

    Sqrt(4) has to be entered as 4 ^ 2 [1/x] = and displays "2"... then subtract 2 and you get


    same result as shown in the published example.

  • That is so strange!!!! I did this using Windows XP Calc and it just showed up with that. Did it with a REAL calculator and it totalled zero and not -8.16484etc.

  • There is a serious bug in this calculator (at least in the Dutch version): the calculator, when used in 'standard mode' does not know about standard precedence rules.

    For instance
    Standard mode: 1 + 9/40 = 0,25;
    Scientific mode: 1 + 9/40 = 1,225 (which is the correct answer).

    Maybe this is not a bug after all, but a feature...

  • If I may i'd like to explain why the scientific calculator has thes "problem". It is true that the normal calculator has a bug. But you have to know that at a scientific calculator the brackets count. That means that the actual calculation would be: sqrt(4)-2 equaling to 0. Sorry Guys

  • It has basic error also.
    For example,

    5*5*5 + 3*3*3 should be 152 but windows 8.1 calculator's answer is 1152 with standard mode.

    It's so stupid to use this calculator.

  • In Windows XP in standard mode its 8.1648465955514287168521180122928e-39 but in scientific mode I can't do that.

  • This is unnecessary ranting, which lacks of a decent amount of investigation. There is no closed form to calculate the square root (pls see, thus every square root you will ever be calculating is an approximation. Of course you can define special cases, such as 4, 9, 16, 25, 36, 49, 64, 81, 100, ... but (a) this would mean, that you'd have to introduce some sort of semantics to a quite simple tool like the calculator, which would definitively be an overkill and (b) where do you stop? Anyone might complain, that 12398765-sqrt(153729373525225) is 5,3026330757729108494341053894116e-31 and not 0. [ironic]This definitively is a bug![/ironic]

    You would not try to make any andvanced numeric calculation with the windows calculator. Would you? For literally every problem solved with the windows calculator -8e-39 will be sufficiently close to 0.

  • I just checked, and this same bug is in the windows 10 calculator! lol

  • This bug only occurs if the answer is supposed to be zero.

    sqrt(4) minus any number other than 1 gives the correct answer

    sqrt(9) minus any number other than 3 gives the right answer.

    sqrt(25) minus any number other than 5 gives the correct answer

    . . . . . and so on.

  • I am getting result 14 for 5 + 2 * 2. It that ok?

  • @Randy That is incorrect. The bug is in the SQRT op. When performing the same calculation twice, the result is the same. It is perfectly consistent. The problem is the result is not perfectly accurate. It would be good if we could see the bitwise representation of the results of the sqrt op.

    The algorithm used is incapable of finding the root of several perfect square numbers. That is what we know.

  • Date Calculation is also wrong in default micro soft calculator as it is showing 1 day less while calculating for a period of one month or more days..

  • The weird point is why the result of 4^0.5 - 2 is different from sqrt(4) - 2, shouldn't they have same algorithms of calculation?!

Leave a Comment