Bug 475018

Summary: HEX->BIN conversion is calculating wrong values
Product: [Applications] kcalc Reporter: Peter Kortmann <pkortmann>
Component: generalAssignee: Evan Teran <evan.teran>
Status: RESOLVED NOT A BUG    
Severity: normal CC: efeciftci, p.r.worrall
Priority: NOR    
Version First Reported In: 20.12.2   
Target Milestone: ---   
Platform: Debian stable   
OS: Linux   
Latest Commit: Version Fixed/Implemented In:
Sentry Crash Report:

Description Peter Kortmann 2023-09-29 10:12:27 UTC
SUMMARY
***
NOTE: If you are reporting a crash, please try to attach a backtrace with debug symbols.
See https://community.kde.org/Guidelines_and_HOWTOs/Debugging/How_to_create_useful_crash_reports
***


STEPS TO REPRODUCE
1. Open KCalc
2. Change to logic mode
3. Change input to HEX, enter 55 (0x55)
4. convert to binary -> click on Bin
5. the conversion should have 8 bits but shows only 7 bits

OBSERVED RESULT
101 0101
the conversion should have 8 bits but shows only 7 bits

EXPECTED RESULT
1010 1010
the conversion should have 8 bits but shows only 7 bits

SOFTWARE/OS VERSIONS
Windows: 
macOS: 
Linux/KDE Plasma: Debian 12, 5.78.0
(available in About System)
KDE Plasma Version: 5.78.0
KDE Frameworks Version:  
Qt Version: 5.15.2

ADDITIONAL INFORMATION
Comment 1 Efe Ciftci 2023-09-29 11:16:50 UTC
The decimal number 5 (0x5 in hexadecimal) is represented as "(0)101" in binary (4+1), therefore I don't see anything wrong with 0x55 -> (0)101 0101. 1010 1010 is 0xAA.
Comment 2 Paul Worrall 2024-03-12 14:51:33 UTC
Setting to "Not a bug" because the conversion is correct and leading zeroes are not shown in any of the number systems