Windows Calculator: A simple yet powerful calculator that ships with Windows

Calculator

The Windows Calculator app is a modern Windows app written in C++ that ships pre-installed with Windows. The app provides standard, scientific, and programmer calculator functionality, as well as a set of converters between various units of measurement and currencies.

Calculator ships regularly with new features and bug fixes. You can get the latest version of Calculator in the Microsoft Store.

Build Status

Calculator Screenshot

Features

  • Standard Calculator functionality which offers basic operations and evaluates commands immediately as they are entered.
  • Scientific Calculator functionality which offers expanded operations and evaluates commands using order of operations.
  • Programmer Calculator functionality which offers common mathematical operations for developers including conversion between common bases.
  • Date Calculation functionality which offers the difference between two dates, as well as the ability to add/subtract years, months and/or days to/from a given input date.
  • Calculation history and memory capabilities.
  • Conversion between many units of measurement.
  • Currency conversion based on data retrieved from Bing.
  • Infinite precision for basic arithmetic operations (addition, subtraction, multiplication, division) so that calculations never lose precision.

Getting started

Prerequisites:

  • Your computer must be running Windows 10, version 1803 or newer.

  • Install the latest version of Visual Studio (the free community edition is sufficient).

    • Install the "Universal Windows Platform Development" workload.
    • Install the optional "C++ Universal Windows Platform tools" component.
    • Install the latest Windows 10 SDK.

    Visual Studio Installation Screenshot

  • Install the XAML Styler Visual Studio extension.

  • Get the code:

    git clone https://github.com/Microsoft/calculator.git
    
  • Open src\Calculator.sln in Visual Studio to build and run the Calculator app.

  • For a general description of the Calculator project architecture see ApplicationArchitecture.md.

  • To run the UI Tests, you need to make sure that Windows Application Driver (WinAppDriver) is installed.

Contributing

Want to contribute? The team encourages community feedback and contributions. Please follow our contributing guidelines.

If Calculator is not working properly, please file a report in the Feedback Hub. We also welcome issues submitted on GitHub.

Roadmap

For information regarding Windows Calculator plans and release schedule, please see the Windows Calculator Roadmap.

Graphing Mode

Adding graphing calculator functionality is on the project roadmap and we hope that this project can create a great end-user experience around graphing. To that end, the UI from the official in-box Windows Calculator is currently part of this repository, although the proprietary Microsoft-built graphing engine, which also drives graphing in Microsoft Mathematics and OneNote, is not. Community members can still be involved in the creation of the UI, however developer builds will not have graphing functionality due to the use of a mock implementation of the engine built on top of a common graphing API.

Diagnostic Data

This project collects usage data and sends it to Microsoft to help improve our products and services. Read our privacy statement to learn more. Diagnostic data is disabled in development builds by default, and can be enabled with the SEND_DIAGNOSTICS build flag.

Currency Converter

Windows Calculator includes a currency converter feature that uses mock data in developer builds. The data that Microsoft uses for the currency converter feature (e.g., in the retail version of the application) is not licensed for your use. The mock data will be clearly identifiable as it references planets instead of countries, and remains static regardless of selected inputs.

Reporting Security Issues

Please refer to SECURITY.md.

License

Copyright (c) Microsoft Corporation. All rights reserved.

Licensed under the MIT License.

Owner
Microsoft
Open source projects and samples from Microsoft
Microsoft
Comments
  • Add settings

    Add settings

    Fixes #596 .

    Description of the changes:

    • Add in a new page, the "Settings" page.
    • Changed the NavView footer to "Settings".
    • Replaced the "About" flyout with the "Settings" page.

    Calculator settings NavBar Change the "About" button in the Navigation Bar to "Settings".

    Calculator settings The new "Settings Page"

    Calculator settings 2 When the user changes the mode, they are prompted to restart the app for changes to take effect.

    Calculator settings 3 When low on space.

    How changes were validated:

    Manual

    P.S. thanks @sanderl for all the help!

  • Improve clarity of math expressions in history for Standard Calculator

    Improve clarity of math expressions in history for Standard Calculator

    Describe the bug Operators precedence in standard mode seems wrong, but works correctly in scientific mode.

    Steps To Reproduce

    1. Use standard mode.
    2. Type: 75×0.3+60×0.7 (which equals to 75*0.3 + 60*0.7)
    3. Press Enter
    4. Now you will get the wrong result.
    5. Switch to scientific mode.
    6. Type the same expression above and submit it.
    7. Now you can get the correct result.

    Expected behavior 75*0.3 + 60*0.7 should be 64.5. However, the calculator will show the wrong result in standard mode.

    Screenshots Standard mode: default

    Scientific mode: default

    Device and Application Information (please complete the following information):

    • OS Build: Windows 10 1803 build 17134.590
    • Architecture: x64
    • Application Version: 10.1811.3241.0

    Possible solution (additional) According to the disscusion of this issue, the calculation is expected. The bug is of the "History Panel". Some folks advised to add parens for expressions to be not confusing.

  • Add CMake/Clang support for the Calculator Engine

    Add CMake/Clang support for the Calculator Engine

    Fixes #109 .

    Description of the changes:

    • Added CMake with a library target for the engine
    • Added cross-platform headers for common Win32 error codes
    • Added typealiases for Win32 data types

    How changes were validated:

    • Manual testing using Apple LLVM version 10.0.0 (clang-1000.11.45.5) on macOS 10.13.6 High Sierra
  • Option to save the current size of the calculator as

    Option to save the current size of the calculator as "user preferred" size and have a way for the user to instantly resize the calculator to their "user preferred" size.

    Problem Statement If a user intentionally or unintentionally resizes the calculator and then closes it, there is no way for them to automatically resize the calculator to the size their were using before.

    Evidence or User Insights "I accidentally resized my calculator. Now I can't undo this back to the optimal size I like it to be."

    Proposal Please add an option for the user to be able to save their preferred calculator size. The size could be limited to several options e.g. Half the screen, a quarter of the screen or just save the current size as default. In order for the user to select their preferred default size, they could click on max button or hit a shortcut key.

    Goals The goal is for the user to be able to use the calculator in the same fashion it uses it on their desktop: The calculator is always ready to be used, lying around on the desktop, never taking the entire working area and never surprising the user by starting in a size that is not comfortable to use.

    Requested Assignment I'm just suggesting this idea. I don't want to implement it.

  • Replace current about dialog with settings page

    Replace current about dialog with settings page

    Problem Statement Calculator currently does not have a settings page, which will block future work. The current about dialog is also inconsistent with many other Microsoft apps.

    Evidence or User Insights Many suggested features have suggested adding options in settings (#538, #486, #485, #393, #382, #215), and while we have not accepted all of these pitches, it is inevitable that there will be functionality requiring settings UX.

    Proposal Replace current about dialog with settings page.

    Goals

    • Replace current about dialog with settings page
    • Be consistent with settings UX patterns established in other Microsoft apps
    • Add basic theme selection option common across many other apps

    Non-Goals

    • Add any additional options at this time

    Low-Fidelity Concept image

    Requested Assignment I'm just suggesting this idea. I don't want to implement it.

  • Linux Build

    Linux Build

    Problem Statement To increase adoption within other operating systems and add more contributors from other developer communities, Microsoft Calculator should be able to be built for Linux.

    Goals This can minimally be an instruction for Linux developers to compile the code, or it can include actual builds and additions to repositories.

  • Port number's mantissa to std::vector

    Port number's mantissa to std::vector

    These are the changes extracted from #211 that port number's mantissa from flexible member arrays, a non-standard C++ extension, to std::vector, which enables compilation and linkage with clang.

    @fwcd is the original author of these changes, I (@janisozaur) merely rebased them on top of current master.

    The rebase was luckily fairly straight-forward, with the only real conflict coming from 7a7ceb58882828096cac87494f5a1ffb5359e212 (https://github.com/microsoft/calculator/pull/412), but was trivial to fix.

  • Copy paste result contains hidden character

    Copy paste result contains hidden character

    Describe the bug

    Copy paste result contains hidden tailing character U+202C which can cause syntax errors to programming languages or breaks in Excel.

    Steps To Reproduce Steps to reproduce the behavior:

    1. Key in an integer.
    2. Double click the number to select it.
    3. CTRL+C.
    4. CTRL+V else where, such as a code editor.

    Expected behavior A clean set of digits entered as valid syntax and works in Excel as a number.

    Screenshots

    image

    Device and Application Information

    • OS Build: 10.0.17134.0
    • Architecture: X64
    • Application Version: 10.1903.21.0
    • Region: en-SG
    • Dev Version Installed: False

    Additional context

  • Alt-3 accelerator key broken

    Alt-3 accelerator key broken

    Describe the bug

    The keyboard accelerator for Programmer Mode of the app no longer functions correctly and instead shows a Graphing mode.

    Steps To Reproduce

    1. Open Calculator
    2. Press Alt-3
    3. Observe Programmer mode is NOT shown

    Expected behavior

    I expect accelerator keys to not change and for Alt-3 to always show the Programmer Mode.

    Screenshots

    Additional context

    Requested Assignment

    I'm just reporting this problem.

  • Replace custom types with standard ones

    Replace custom types with standard ones

    I was halfway through changing the types, when https://github.com/Microsoft/calculator/pull/211 was submitted. As I have ran out of time today to finish it up, I submit it as-is for discussion and would like to hear from Microsoft team on which approach is preferred.

  • Pressing enter in scientific mode opens navigation instead of displaying the result

    Pressing enter in scientific mode opens navigation instead of displaying the result

    In scientific mode, after pressing the Enter button, navigation menu opens instead of displaying the result.

    Steps To Reproduce

    1. Go to Scientific mode.
    2. Click on C.
    3. Enter 2+2 on keyboard.
    4. Press Enter on keyboard.

    Expected behavior Result is displayed.

    Actual behavior Navigation menu is opened.

    Device and Application Information

    • OS Build: 10.0.17134.0
    • Architecture: X64
    • Application Version: 10.1910.0.0
    • Region: en-US
    • Dev Version Installed: -

    Requested Assignment I'm just reporting this problem. I don't want to fix it.

  • After selecting a currency that does not allow decimal values, then switching to another converter, calculator will not allow decimal input

    After selecting a currency that does not allow decimal values, then switching to another converter, calculator will not allow decimal input

    Steps To Reproduce

    1. Goto Currency screen
    2. Select a currency that does not allow decimal values (such as JPY)
    3. Switch to another converteer (e.g. length)
    4. Cannot enter decimal values :(

    Going back to the Currency screen and selecting a currency that does allow decimals fixes this.

    https://user-images.githubusercontent.com/36283656/168670354-4137ea6e-6fdc-45f9-b567-0d3859c17f3d.mp4

  • Graphing - logarithmic scale

    Graphing - logarithmic scale

    Problem Statement

    When I have a graph of a function, I sometimes want to display it on a logarithmic scale.

    Evidence or User Insights

    Proposal

    In "Graph options" should be option to scale:

    1. X a) linear b) logarithmic
    2. Y a) linear b) logarithmic (default) should be linear

    Goals

    Choose each axis to display graph data in logarithmic or linear.

    Non-Goals

    Low-Fidelity Concept

    | |--------|----|--|-|--------|----|--|-| ... |

    Requested Assignment

    I'm just suggesting this idea.

  • Search box for currency

    Search box for currency

    Problem Statement

    It is really hard to find country inside currency without search box

    Evidence or User Insights

    Proposal

    When the user clicks on the drop-down menu in the top will be a seach box to fillter countries.

    Goals

    Non-Goals

    Low-Fidelity Concept

    image

    Requested Assignment

    I'm just suggesting this idea. I don't want to implement it.

  • Remove focus border when loaded in run window

    Remove focus border when loaded in run window

    Describe the bug

    When loaded the app, a focus border always shows. image

    Steps To Reproduce

    1. Press win + R to open run window.
    2. type calc, and press enter key.
    3. See error

    Expected behavior

    Loaded with no focus border image

    Screenshots

    Device and Application Information

    • OS Build:22000.613
    • Architecture:x64
    • Application Version:11.2201.4.0
    • Region:zh-cn
    • Dev Version Installed:

    Additional context

    Requested Assignment

    I'm just reporting this problem. I don't want to fix it.

  • Implement two's complement switch in the programmer calculator

    Implement two's complement switch in the programmer calculator

    Goals

    I'm currently deciphering a binary protocol, which is binary galore, so this would be helpful, maybe it'd even help explaining the concept to someone.

  • Calculator visual tweaks

    Calculator visual tweaks

    Problem Statement Calculator has received the Windows 11 visual update a while ago, but I think it can be further improved.

    An important part of the new visual design is using layers to separate different surfaces, and Calculator could benefit from this. It creates a clearer visual hierarchy, but it also improves the design of the application.

    There are also some other leftover bits that don't really align with the new design.

    Proposal Layering could be used for the number pad, history/memory items, the grapher and equation items.

    Some other visual changes that could be done:

    • The menus on top of the grapher would work well with acrylic and shadows, since they are technically overlays.
    • The equation input controls could look more like the new textboxes

    Low-Fidelity Concept expanded graphing

    Requested Assignment If possible, I would like to implement this.

Jing-Kalk is a beautifully designed calculator that conforms to the JingOS style and Integrating the interactive experience of pad and PC.
Jing-Kalk is a beautifully designed calculator that conforms to the JingOS style and Integrating the interactive experience of pad and PC.

Jing-Kalk Jing-Kalk is based on Kalk gitlab. Jing-Kalk is a beautifully designed calculator that conforms to the JingOS style and Integrating the inte

May 13, 2022
nml is a simple matrix and linear algebra library written in standard C.

nml is a simple matrix and linear algebra library written in standard C.

Apr 21, 2022
Simple long integer math library for C++

SLIMCPP Simple long integer math library for C++ SLIMCPP is C++ header-only library that implements long integers that exceed maximum size of native t

Feb 6, 2022
Header only, single file, simple and efficient C++ library to compute the signed distance function to a triangle mesh

TriangleMeshDistance Header only, single file, simple and efficient C++11 library to compute the signed distance function to a triangle mesh. The dist

May 8, 2022
A simple C++ complex & real matrix library, with matrix inversion, left division and determinant calculation

NaiveMatrixLib 帆帆的简易矩阵计算库 A simple C++ stdlib-based complex & real matrix library, with matrix inversion, left division (A\b) and determinant calculat

Apr 27, 2022
Easy-to-use Scientific Computing library in/for C++ available for Linux and Windows.

Matrix Table of Contents Installation Development 2.1. Linux 2.2. Windows Benchmarking Testing Quick Start Guide 5.1. Initializers 5.2. Slicing 5.3. P

May 14, 2022
Flameshot - Powerful yet simple to use screenshot software.
Flameshot - Powerful yet simple to use screenshot software.

Flameshot - Powerful yet simple to use screenshot software.

May 14, 2022
A perfect blend of C, Java, and Python tailored for those who desire a simple yet powerful programming language.

Fastcode A perfect blend of C, Java, and Python tailored for those who desire a simple yet powerful programming language. FastCode is a procedural/str

Apr 18, 2022
Extremely simple yet powerful header-only C++ plotting library built on the popular matplotlib
Extremely simple yet powerful header-only C++ plotting library built on the popular matplotlib

matplotlib-cpp Welcome to matplotlib-cpp, possibly the simplest C++ plotting library. It is built to resemble the plotting API used by Matlab and matp

May 21, 2022
A Simple yet Powerful and Ultrafast File Minifier

Minifier A Simple yet Powerful and Ultrafast File Minifier. Minifier will Minify your Code within Milliseconds. Usage minifier [Input File] [Output Fi

Oct 5, 2021
C++ mocking made easy. A simple yet very expressive, headers only library for c++ mocking.

FakeIt GCC: MSC: FakeIt is a simple mocking framework for C++. It supports GCC, Clang and MS Visual C++. FakeIt is written in C++11 and can be used fo

May 11, 2022
Simple yet fancy CPU architecture fetching tool
Simple yet fancy CPU architecture fetching tool

Simple yet fancy CPU architecture fetching tool

May 11, 2022
AxeraVision / Simple yet customizable UI using ImGui Framework
AxeraVision / Simple yet customizable UI using ImGui Framework

[ AxeraVision UI ] This repository features a base UI using the ImGui Framework. Features Simple UI Design Easy Code to Customize Good Starting Base U

May 5, 2022
rCalc is a Simple GUI Calculator
rCalc is a Simple GUI Calculator

rCalc is a simple calculator created as a hobby project to improve my C programming language knowledge and GUI creation skills. GTK3 toolkit is used to create the GUI.

Jan 23, 2022
Simple BMI Calculator application written in C++

BMI-Calculator Description Simple BMI Calculator application written in C++ Getting Started Authors Minyoung An @minyoung_an Version History 0.1 Initi

Nov 25, 2021
Simple BMI Calculator
Simple BMI Calculator

BMI Calculator. Screenshots Getting Started This project is a starting point for a Flutter application. A few resources to get you started if this

Feb 13, 2022
Yet another approach to developing a personal 3D graphics engine. Windows + Direct3D 12.

RegEngine Yet another approach to developing a personal 3D graphics engine. Windows + Direct3D 12. Work in progress... Nothing to see here. I just ren

Apr 18, 2022
A simple header-only C++ argument parser library. Supposed to be flexible and powerful, and attempts to be compatible with the functionality of the Python standard argparse library (though not necessarily the API).

args Note that this library is essentially in maintenance mode. I haven't had the time to work on it or give it the love that it deserves. I'm not add

May 18, 2022
A simple but powerful multimedia player library designed for Qt Quick.

QtMediaPlayer A simple but powerful multimedia player library designed for Qt Quick. Features Full-featured multimedia player Cross-platform: support

Apr 21, 2022
A simple header-only C++ argument parser library. Supposed to be flexible and powerful, and attempts to be compatible with the functionality of the Python standard argparse library (though not necessarily the API).

args Note that this library is essentially in maintenance mode. I haven't had the time to work on it or give it the love that it deserves. I'm not add

Aug 31, 2021