Bug 432377

Summary: KRunner calculator wrongly interpret hex numbers starting with digit as multiplication
Product: [Plasma] krunner Reporter: Mykola Krachkovsky <w01dnick>
Component: calculatorAssignee: Alexander Lohnau <alexander.lohnau>
Status: RESOLVED FIXED    
Severity: normal CC: plasma-bugs
Priority: NOR    
Version: 5.20.5   
Target Milestone: ---   
Platform: Other   
OS: Linux   
Latest Commit: Version Fixed In: 5.21
Sentry Crash Report:

Description Mykola Krachkovsky 2021-02-01 11:50:36 UTC
SUMMARY

KRunner's calculator seems interpret hex numbers starting with digit as a multiplication leading to zero result.

STEPS TO REPRODUCE
1. Open KRunner
2. Type `=0x20`

OBSERVED RESULT
0

EXPECTED RESULT
32

SOFTWARE/OS VERSIONS
Operating System: openSUSE Tumbleweed 20210130
KDE Plasma Version: 5.20.5
KDE Frameworks Version: 5.78.0
Qt Version: 5.15.2
Kernel Version: 5.10.9-1-default
OS Type: 64-bit

ADDITIONAL INFORMATION

It seems krunner's calculator may interpret `x` as multiplication, e.g. `=4x5`->`20`. If this is needed for anyone, still `0x4` as multiplication is pointless, so IMHO, it's better to keep `0x` prefix just for hex numbers and interpret `x` as multiplication only when there is non-zero value before `x`.
Comment 1 Alexander Lohnau 2021-02-01 11:57:06 UTC
Already fixed with https://invent.kde.org/plasma/plasma-workspace/-/merge_requests/571
Comment 2 Mykola Krachkovsky 2021-02-01 11:59:20 UTC
Thanks!