microsoft / PowerToys

Windows system utilities to maximize productivity
MIT License
110.59k stars 6.52k forks source link

PowerToy Run UnitConverter float number precision is not enough #17610

Closed helsmy closed 2 years ago

helsmy commented 2 years ago

Microsoft PowerToys version

"0.57.2"

Running as admin

Area(s) with issue?

PowerToys Run

Steps to reproduce

Type %% 1nm in m --> 0m Any small enough unit will be took as 0 in larger unit. 图片

✔️ Expected Behavior

Type %% 1nm in m --> 1e-9m or 0.00000001m

❌ Actual Behavior

Type %% 1nm in m --> 0m

Other Software

No response

helsmy commented 2 years ago

Besides, it will be better if result could be displayed as scientific notation formation. Thanks in advance.

lncubus commented 2 years ago

Calculator is also affected by this. If I try =1/100000000000 I got 0,0000000000.

lncubus commented 2 years ago

Also we have 1 km to nm = 999999999999,9998 and 1 mile to nm = 1609339999999,9998 The reason is we always use Math.Round(convertedValue, _roundingFractionalDigits) with _roundingFractionalDigits = 4 in UnitHandler class. We need to make it more intelligent to handle four significant digits, not four digits after decimal separator.