microsoft / calculator

Windows Calculator: A simple yet powerful calculator that ships with Windows
MIT License
29.75k stars 5.39k forks source link

Typing "sin^-1(x)" and "Enter" in the graphing calculator causes the app to crash. #2009

Open tian-lt opened 1 year ago

tian-lt commented 1 year ago

Describe the bug Typing "sin^-1(x)" and "Enter" in the graphing calculator causes the app to crash.

calc-crash

Steps To Reproduce Steps to reproduce the behavior:

  1. Go to 'Graphing mode'
  2. Type "sin^-1(x)" and then "enter" in the textbox
  3. The app will crash

Expected behavior No app crash and the function get plotted correctly.

Device and Application Information

BaileyFurrow commented 1 year ago

TL;DR

Use arcsin(x) instead.

Crash Explanation

When entering math expressions and functions, Windows Calculator will only read the first symbol after the caret (^) symbol for exponents (there is an exception to this, see Method 2 below). When entering sin^-1(x) into the graphing calculator, Windows Calculator attempts to interpret the entered expression as $sin^{-}$ of $1(x)$ instead of the intended $sin^{-1}(x)$. $sin^{-}$ is not a valid function, so this causes the app to crash.

How to Fix

There are two methods to get this function to work correctly.

Method 1: arcsin

The first and simplest method is to use the arcsin function. You can either type in arcsin(x) or use the Trigonometry menu, select 2nd, and select sin-1. The latter is demonstrated below:

ApplicationFrameHost_2023-06-03_214917

Method 2: Typing in $sin^{-1}(x)$ correctly

Alternatively, you can type out the function as $sin^{-1}(x)$ by placing the exponent in parentheses. Before, I mentioned that Windows Calculator will only read the first symbol after ^ for exponents. There is an exception to this rule; if the first symbol after ^ is (, then everything in parentheses will be used as the exponent.

In other words, put parentheses around -1. Your syntax will look like this: sin^(-1)(x). The GIF below demonstrates that this works.

ApplicationFrameHost_2023-06-03_215110

Note that when this is typed in, Windows Calculator will automatically change the text you entered to display arcsin(x) instead.

I hope this helps!

MicrosoftIssueBot commented 1 year ago

This is your friendly Microsoft Issue Bot. I've seen this issue come in and have gone to tell a human about it.