Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Run, tracker] calculator (mage nuget) having calculation issues #3697

Closed
Jay-o-Way opened this issue May 25, 2020 · 10 comments
Closed

[Run, tracker] calculator (mage nuget) having calculation issues #3697

Jay-o-Way opened this issue May 25, 2020 · 10 comments
Assignees
Labels
Issue-Bug Something isn't working Product-PowerToys Run Improved app launch PT Run (Win+R) Window Resolution-Fix Committed Fix is checked in, but it might be 3-4 weeks until a release.

Comments

@Jay-o-Way
Copy link
Collaborator

Jay-o-Way commented May 25, 2020

Environment

PowerToys version: 0.18.1
PowerToy module for which you are reporting the bug (if applicable): Power Run

Example 1 : digits after the decimal point

Example: type "123 * 4.56"
Result = 560,8800000000001

Probably an an issue with the signing of the number, since the total amount of digits is 16, or converting binary to decimal. When using one negative number, the result = -560,8800000000001.

Power Run - calculator - new digits

Example 2 : no operator

Example: type "123 456"
Result = 56088

No operator is used here. I know that multliplication may be implied between numbers and constants, or between numbers and (other things in) brackets, but not between numbers only. Also, spaces may sometimes be used in big numbers as thousands separators.

Suggestion: Spaces between only numbers should be ignored (like treated as thousands separators). Unless somebody else has a better idea?

Power Run - calculator - no operator

@Jay-o-Way Jay-o-Way changed the title calculator in Power Run has some small issues [Power Run] calculator has some small issues May 25, 2020
@RWeigelt
Copy link

Maybe the math code of the open-sourced Windows Calculator could be a good fit here, because it has solved problems like in example 1. It is written in C++, though, and I don't know how much work would be required for using it outside calc.exe.

@Jay-o-Way
Copy link
Collaborator Author

This is probably gonna sound like a rookie comment, but using open source Windows code that is already out there, sounds pretty obvious to me. Re-inventing things that already have been made in/for a similar situation sounds like a lot of "wasted" time and energy? 🤓

@jyuwono
Copy link
Contributor

jyuwono commented May 26, 2020

Related to #3488 and #2265

@jyuwono jyuwono added the Product-PowerToys Run Improved app launch PT Run (Win+R) Window label May 26, 2020
@crutkas crutkas added this to the v1.0 Release milestone May 27, 2020
@crutkas crutkas changed the title [Power Run] calculator has some small issues [Power Run] calculator (mage nuget) having calculation issues May 27, 2020
@crutkas crutkas added the Issue-Bug Something isn't working label May 27, 2020
@jyuwono jyuwono changed the title [Power Run] calculator (mage nuget) having calculation issues [Run, tracker] calculator (mage nuget) having calculation issues Jun 1, 2020
@VisibleReality
Copy link

One interesting thing I noticed is that example 1 doesn't happen with more complex calculations (maybe when brackets are involved?)
image

@mkielar
Copy link

mkielar commented Jun 6, 2020

I gets weird even for simple additions.

obraz

@androidSwDev099
Copy link

androidSwDev099 commented Jun 9, 2020

Simple examples to demonstrate.

More strangeness when entered 39.9 .... why is it proposing a different number?

image

39.9 + 1
image

@Jay-o-Way

This comment has been minimized.

@crutkas
Copy link
Member

crutkas commented Jul 31, 2020

xref #3764

@crutkas
Copy link
Member

crutkas commented Aug 13, 2020

in calculator plugin, Mages looks like it is doing some type of odd casting.

Works

  • 2+2.1
  • 2+2.1111

Incorrect

  • 2+2.11
  • 2+2.111

var result = MagesEngine.Interpret(query.Search); is what does the calc.

@crutkas crutkas self-assigned this Aug 13, 2020
@crutkas crutkas added the Status-In progress This issue or work-item is under development label Aug 13, 2020
@crutkas crutkas added the Resolution-Fix Committed Fix is checked in, but it might be 3-4 weeks until a release. label Aug 13, 2020
@crutkas
Copy link
Member

crutkas commented Sep 2, 2020

This should be resolved in our 0.21.1 release of PowerToys. https://github.com/microsoft/PowerToys/releases/tag/v0.21.1 to download it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Issue-Bug Something isn't working Product-PowerToys Run Improved app launch PT Run (Win+R) Window Resolution-Fix Committed Fix is checked in, but it might be 3-4 weeks until a release.
Projects
None yet
Development

No branches or pull requests

7 participants