July 4th, 2018

The Windows Calculator no longer generates tiny errors when calculating the square root of a perfect square

Some time ago, I explained why the Windows Calculator generates tiny errors when calculating the square root of a perfect square.

Good news! Square roots of perfect squares are now exact!

In fact, it’s more than just square roots of perfect squares. Perfect cube roots of perfect cubes are also exact. In general, rational roots and powers of integers will come out exact if the result is an integer. For example, raising 8 to the ⅔ power will produce 4 exactly.

Getting the exact result is considerably more computationally expensive, but the calculator is not a performance-sensitive program. If calculating the ⅔ power of a number takes an extra 10 milliseconds, nobody will care.

When the Calculator team announced this change at an internal event, they wore custom-made T-shirts that said

−1.06828
1969439
142e−19

Update:

Author

Raymond has been involved in the evolution of Windows for more than 30 years. In 2003, he began a Web site known as The Old New Thing which has grown in popularity far beyond his wildest imagination, a development which still gives him the heebie-jeebies. The Web site spawned a book, coincidentally also titled The Old New Thing (Addison Wesley 2007). He occasionally appears on the Windows Dev Docs Twitter account to tell stories which convey no useful information.

0 comments

Discussion are closed.