microsoft / calculator

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

Entering negative exponents in Scientific mode is not supported #1311

Open SaprativRay opened 4 years ago

SaprativRay commented 4 years ago

Describe the bug The Calculator app does not support entering negative exponents. For example, in the Scientific mode, we can enter "2.6e2" produces the expected output 260 but trying to type "2.6e-2" does not give 0.026 as it should. I even tried to put the -2 within parentheses to make sure it understands that the dash symbol is not for subtraction here but even that fails.

Steps To Reproduce

  1. Open the Calculator app in Scientific mode.
  2. Type "2.6e-2" and attempt to calculate it.
  3. The answer reported back is 0.6 instead of the expected 0.026.

Expected behavior The Calculator app should ideally support entering negative exponents and on typing "2.6e-2" in Scientific mode, it should understand that a dash following an exponent symbol 'e' is not supposed to mean subtraction but a negation.

Screenshots image

Device and Application Information

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

shobhit-kumar-code commented 4 years ago

I agree. I feel that typing a '-' after 'e' should make the exponent negative.

MicrosoftIssueBot commented 4 years ago

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

grochocki commented 4 years ago

Thanks for the bug report! If you use the in-app keyboard, it works as expected, but I agree that when typing it out, we should be smarter at handling negation vs. subtraction in this case.

paynterf commented 4 years ago

Thanks for the bug report! If you use the in-app keyboard, it works as expected, but I agree that when typing it out, we should be smarter at handling negation vs. subtraction in this case.

Not for me it doesn't. Using the in-app keyboard for the above example results in 0.6, just as above.

Calculator 10.2005.23.0 Windows 10 PRO 10.0.18362 Build 18362

grochocki commented 4 years ago

Hmm, this is what I see (for me, it works regardless to whether you hit +/-2 or 2+/-):

sec905t08T

paynterf commented 4 years ago

Ah, the mysterious '+/-' key! That did the trick, but I gotta ask, why doesn't

2.6 [exp] - (the regular minus key) 2

work? After all, that is the normal entry sequence.....

Frank

grochocki commented 4 years ago

I suspect what is happening here is that we are strictly parsing - (and the minus key on a physical keyboard) as subtract. In many cases -2 will effectively give you -2. Even when entering something like 5+-2, we show 3, but adding a negative is the same as subtraction. In some cases, like here when trying to input a number in scientific notation, processing as subtraction causes the issue.

paynterf commented 4 years ago

Yes, I agree that's what is happening, but I hope you agree that for a calculator app to insist on parsing the '-' sign as 'subtraction' immediately after the user presses the 'exp' key isn't very helpful. I don't know who was programming this, but they obviously don't know much about math notation ;-).

Frank

grochocki commented 4 years ago

I hope you agree that for a calculator app to insist on parsing the '-' sign as 'subtraction' immediately after the user presses the 'exp' key isn't very helpful.

I agree! I think we can certainly be smarter about handling the '-' contextually based on what else you are inputting.

MovGP0 commented 4 years ago

the requirement to use the [EXP] button is annoying. I just want to type 2.6*10^-2 on the keyboard and be done with it.

image

paynterf commented 4 years ago

I certainly agree with that sentiment. Having a 'scientific' calculator that doesn't know exponential notation that has been in common use for decades is a bit of a joke, IMHO

elmorr commented 3 years ago

Try pressing 'e' will get you X*10^Y as well. Apparently only F9 gets the '+/-' quick key function (from the Windows site: https://support.microsoft.com/en-us/windows/keyboard-shortcuts-in-apps-139014e7-177b-d1f3-eb2e-7298b2599a34#bkmk_cal)

Michael-McD commented 3 years ago

Does anyone know of a better caculator for maths on Windows other than the bundled one?

Caculating negative exponents of Eulers constant is not very intuitive at all.

localehost commented 1 year ago

i have solved this issue if you want negative exponent type 2^(-5) this will solve your issue Thanks me later

Azazuplayz commented 9 months ago

looks like the sequence you enter values is the issue. If you enter for example, 2^5 then hit the (+/-) key in the calculator app, it gives you the correct result. However, if you try 2^(-5), it would result in 32. If you want to test it out, follow the order below and it should work as expected.

1st - Click Red 2nd - Click Yellow 3rd - Click Green 4th - Click Blue 5th - Click Purple

Calculator

jimklimov commented 5 months ago

Thanks to the hints above, I've tried to click it all the way with the mouse to get a precise representation of 1,39 * 10^(-6) as a decimal for a test ride:

So far so good.

Copying it out of the calculator into this post proved to be a hassle - Ctrl+C was apparently ignored; right-clicking on the numeric display offered a context menu to "Select All" first, then it could "Copy". The selection is not highlighted (background remains white) which is not too helpful but oh well :) UPDATE: It did highlight for Ctrl+A, and later for another mouse context menu attempt. Maybe it matters which part of the display area I clicked into.

Following another suggestion for F9 = +/- also worked for a completely-keyboard typing session:

Finally, pasting 1,39 * 10^(-6) also worked (but required the parentheses around -6).