47

calc.exe is now open source; there’s surprising depth in its ancient code

 5 years ago
source link: https://www.tuicool.com/articles/hit/iuyEZzU
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

Microsoft's embrace and adoption of open source software has continued with the surprising decision to publish the code for Windows Calculator and release it on GitHub under the permissive MIT license.

The repository shows Calculator's surprisingly long history. Although it is in some regards one of the most modern Windows applications—it's an early adopter ofFluent Design and has been used to showcase a number of design elements—core parts of the codebase date all the way back to 1995.

The actual calculations are performed by this ancient code. Calculator's mathematics library is built using rational numbers (that is, numbers that can be expressed as the ratio of two integers). Where possible, it preserves the exact values of the numbers it is computing, falling back on Taylor series expansion when an approximation to an irrational number is required. Poking around the change history shows that the very earliest iterations of Windows Calculator, starting in 1989, didn't use the rational arithmetic library, instead using floating point arithmetic and the much greater loss of precision this implies.

The project also includes a roadmap for future development. Microsoft wants to continue to iterate on Calculator's use of Fluent Design, develop a more complete set of tests, and then add new features as requested by users. A few bugs and feature requests have already been filed, and Microsoft has already merged a number of outside contributions to fix some minor coding errors.


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK