microsoft / PowerToys

Windows system utilities to maximize productivity
MIT License
109.43k stars 6.45k forks source link

Powertoys run calculator weird behavior with space-separated thousands #34145

Open Akatroj opened 1 month ago

Akatroj commented 1 month ago

Microsoft PowerToys version

0.83.0

Installation method

PowerToys auto-update

Running as admin

No

Area(s) with issue?

PowerToys Run

Steps to reproduce

  1. Open powertoys run
  2. Type in 100 500/100 - the result is incorrect (500 instead of 1005)
  3. If we type in 100500/100 (without the separator), we get the correct result - 1005.

I believe this is because the whitespace will be treated as implied multiplication, so the equation becomes 100(500/100) = 500

✔️ Expected Behavior

Whitespace can be used for thousands separator.

According to Wikipedia, space is the internationally recommended thousands separator.

❌ Actual Behavior

Doing calculations with large numbers formatted with whitespace as thousand separator give misleading results.

Other Software

No response

similar-issues-ai[bot] commented 1 month ago

We've found some similar issues:

If any of the above are duplicates, please consider closing this issue out and adding additional context in the original issue.

Note: You can give me feedback by 👍 or 👎 this comment.

Akatroj commented 1 month ago

okay, my issue appears to be a duplicate of #11786 (with more serious consequences than the original issue).

It would probably be resolved by #2265, but I would like to point out, that issue is 4 years old and is blocked by the microsoft calculator team. Looking through all the issues closed as duplicates/contained within #2265, I can see that there are many problems with the current calculator and it doesn't look like https://github.com/microsoft/calculator/issues/526 will happen any time soon, so maybe you could consider some alternative solutions?

Jay-o-Way commented 1 month ago

Ping @crutkas @ethanfangg @htcfreek Wanna emphasize the many issue related to the separator char

crutkas commented 1 month ago

Answer here would be to just remove the whitespace which would be a easy fix. Calc seems to do that.

crutkas commented 1 month ago

@jay-o-way, this is different than comma vs period and when people mix and match them.

Jay-o-Way commented 1 month ago

Answer here would be to just remove the whitespace which would be a easy fix. Calc seems to do that.

That changes the current behavior of an implied multiplication.

BreakingChange

htcfreek commented 1 month ago

@jay-o-way, this is different than comma vs period and when people mix and match them.

@crutkas What @Jay-o-Way means is that mages interprets space as multiplication: 10 10 is the same as 10*10. Removing all soaces brings the problem to know if it is a thousand separator space or a multiplication space.