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][Calculator Plugin] Support Hexadecimal calculations #3272

Closed
dantler opened this issue May 20, 2020 · 9 comments
Closed

[Run][Calculator Plugin] Support Hexadecimal calculations #3272

dantler opened this issue May 20, 2020 · 9 comments
Labels
Idea-Enhancement New feature or request on an existing product Product-PowerToys Run Improved app launch PT Run (Win+R) Window Run-Plugin Things that relate with PowerToys Run's plugin interface

Comments

@dantler
Copy link

dantler commented May 20, 2020

Summary of the new feature/enhancement

It would be awesome if I could use PowerToys Run to do quick hexadecimal calculations.

Example input:

  • 0xF + 0x1

Example output:

  • 16
  • 0x10

With the implementation of this groundbreaking new feature, the common error of 0xG could be avoided.

Proposed technical implementation details (optional)

Utilize the Busy Wait Algorithm (BWA) so the user gets the feeling that the computer is thinking very hard.

Bounty

I will post one smiley face emoji upon completion of this task.

@jyuwono jyuwono added the Product-PowerToys Run Improved app launch PT Run (Win+R) Window label May 20, 2020
@jyuwono jyuwono added the Idea-Enhancement New feature or request on an existing product label Jun 3, 2020
@jyuwono jyuwono added this to the Suggested Enhancements milestone Jun 3, 2020
@dnlmlr
Copy link

dnlmlr commented Jul 2, 2020

I did not find this issue when creating my own. Still in my issue there were other features discussed (binary & conversion in particular), so I would suggest keeping the issue in mind when thinking about implementing this #4690 (comment)

Summary of the new feature/enhancement

PT Run is already my goto way for doing small calculations. However I quite often need to do calculations, as well as conversions with different positional systems (mainly hex and binary).
It would be great if the built in calculator would support hex numbers by using the 0xHH notations and binary numbers by using the 0bXX notation. The result could be presented in the same system that is used in the calculation. If the calculation is mixing systems (for example hex and decimal), the result might default to decimal instead.
A conversion could also be implemented by using a notation similar to python-like casts: hex(some_numer), bin(some_number), dec(some_number).

Some possible calculation examples using the proposed system:
0xff + 0b100000000 -> 511
hex(0xff + 0b100000000) -> 0x1ff
bin(0xac) -> 0b10101100
hex(674) -> 0x2a2

@Joinyy
Copy link

Joinyy commented Jul 13, 2020

I also like the feature that Keypirinha has, that if I type some calculation I get multiple results with different formats:

> floor(16.5 * 1024) gives the result list:

             16407
            0x4017
0b0100000000010111

@crutkas crutkas added the Run-Plugin Things that relate with PowerToys Run's plugin interface label Aug 12, 2020
@crutkas
Copy link
Member

crutkas commented Dec 8, 2020

this work item may solve this: #2265 which will encompass microsoft/calculator#526

Need to validate what items it will enable.

@crutkas
Copy link
Member

crutkas commented Apr 29, 2023

PT Run can do this now. verified under 0.69.1
image

@crutkas crutkas closed this as completed Apr 29, 2023
@Joinyy
Copy link

Joinyy commented Apr 29, 2023

Would be nice if there was also hex output in a second row to choose from, especially when calculating multiple memory offsets or similar stuff I want to stay in hex for most calculations.

@dantler
Copy link
Author

dantler commented Apr 29, 2023

😀

@zsynacl
Copy link

zsynacl commented Nov 2, 2023

encountered some problem when using hexademical calculation
#29632

It would be great if someone can check what's going on.🌷

@ukanuk
Copy link

ukanuk commented Nov 30, 2023

Also see #12571 and #27760, making PowerToys Run support programmer conversions would let me stop needing the Windows Calculator app. I regularly convert between binary, decimal, and hexadecimal for my work with Siemens and Rockwell PLCs for industrial automation (factory manufacturing). Bonus points if the common PLC number notations were also supported, e.g. 2#1111_1111 for binary, 8#7777_7777 for octal, and 16#FFFF_FFFF for hex. Lastly it would be nice if this were more clearly documented in PowerToys; I had no clue the Run dialog supported hex until I searched the Github and found this issue. I did try entering 16#80A4 into the run dialog but nothing happened, so I assumed there wasn't any support. Here are some representative calculations I currently do with Windows calculator and sites like https://www.rapidtables.com/convert/number/hex-to-decimal.html?x=80A4

Convert 1310 from decimal to binary for setting DIP switches for a Siemens F-Address:
13102#0101_0001_1110

Convert binary error code from raw device output into decimal for lookup in device manufacturer's error manual:
2#1101_1110222 Atlas Copco Henrob "Die Check Camera: Ref. Image Does not Exist"

Convert unsigned decimal error code from raw device output into hexadecimal for lookup in device manufacturer's error manual:
3293216#80A4 Siemens "The CPU does not support this function"

Convert signed decimal error code from raw device output into hexadecimal for lookup in device manufacturer's error manual:
-3260416#80A4 Siemens "The CPU does not support this function"

@Jwiggiff
Copy link

Any update on being able to convert bases? i.e. like what @dnlmlr said:

hex(674) -> 0x2a2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Idea-Enhancement New feature or request on an existing product Product-PowerToys Run Improved app launch PT Run (Win+R) Window Run-Plugin Things that relate with PowerToys Run's plugin interface
Projects
None yet
Development

No branches or pull requests

8 participants