Bug 489960

Summary: kcalc: changing radix loses value in calculation
Product: [Applications] kcalc Reporter: cat22 <erbenton>
Component: generalAssignee: Evan Teran <evan.teran>
Status: RESOLVED INTENTIONAL    
Severity: normal CC: gabriel.barrantes.dev
Priority: NOR    
Version First Reported In: 24.05.2   
Target Milestone: ---   
Platform: Other   
OS: Linux   
Latest Commit: Version Fixed/Implemented In:
Sentry Crash Report:

Description cat22 2024-07-09 07:52:00 UTC
***
If you're not sure this is actually a bug, instead post about it at https://discuss.kde.org

If you're reporting a crash, attach a backtrace with debug symbols; see https://community.kde.org/Guidelines_and_HOWTOs/Debugging/How_to_create_useful_crash_reports
***

SUMMARY
kcalc 24.05.2

STEPS TO REPRODUCE
1.  enter a value in any radix
2. change the radix
3.  hit + then a number like 2 for example


OBSERVED RESULT
Input Error

EXPECTED RESULT
The value plus 2 expressed in the new radix

SOFTWARE/OS VERSIONS
KDE  Plasma 6.1.2
Qt:    5.15.14
KDE Plasma Version: 
KDE Frameworks Version:  6.3.0 according to Help -> About
Qt Version:   6.7.2 according to Help -> About

ADDITIONAL INFORMATION
also, enter a number in decimal - for example 4
Select binary
The bit  edit isn't updated (unless you press ENTER button) and the value isn't changed to binary in the edit window
This is  true of any radix  for similar valid ops, e,g enter 68 as a decimal and then hit hex
the display isn't changed to he hex value of 44
Also, AC does not clear the bit edit
Comment 1 Gabriel Barrantes 2024-07-09 14:51:37 UTC
> ADDITIONAL INFORMATION
> also, enter a number in decimal - for example 4
> Select binary
> The bit  edit isn't updated (unless you press ENTER button) and the value
> isn't changed to binary in the edit window
> This is  true of any radix  for similar valid ops, e,g enter 68 as a decimal
> and then hit hex
> the display isn't changed to he hex value of 44
> Also, AC does not clear the bit edit

This is covered in 489660.
Comment 2 Gabriel Barrantes 2024-07-09 14:57:38 UTC
> STEPS TO REPRODUCE
> 1.  enter a value in any radix
> 2. change the radix
> 3.  hit + then a number like 2 for example
> 
> 
> OBSERVED RESULT
> Input Error
> 
> EXPECTED RESULT
> The value plus 2 expressed in the new radix

I guess that for now that is intended... You probably entered a value that is not valid in the base you changed into.
For example if you enter 9 while in decimal and then change to octal, the 9 will remain and is not a valid octal entry, so 9+2 will give input error... The proper fix will require to update the input to be 0o11 (9) but requires a significant amount of work... Open a feature request for it.
Comment 3 cat22 2024-07-14 03:10:33 UTC
This all worked correctly in an earlier version of kcalc,  I'm guessing more than a few months ago at most.