Created attachment 170633 [details] Screenshot showing the input error SUMMARY KCalc does not seem to accept (some) hexadecimal numbers. STEPS TO REPRODUCE 1. Enable "Numeral System Mode" 2. Switch to "Hex" mode 3. Paste "0x400095f0" into the line edit 4. Hit enter OBSERVED RESULT Input error EXPECTED RESULT 0x400095f0 ADDITIONAL INFORMATION The same happens for "400095f0" and other hexadecimal numbers.
*** Bug 485319 has been marked as a duplicate of this bug. ***
(In reply to popov895 from comment #1) > *** Bug 485319 has been marked as a duplicate of this bug. *** Some more test cases for version 24.05.1: ab -- Input error AB -- AB 00AB -- 0 00ab -- Input error 0x00AB -- AB 0x00ab -- Input error
(In reply to Deriabin Sergei from comment #2) > (In reply to popov895 from comment #1) > > *** Bug 485319 has been marked as a duplicate of this bug. *** > Some more test cases for version 24.05.1: > ab -- Input error > AB -- AB > 00AB -- 0 > 00ab -- Input error > 0x00AB -- AB > 0x00ab -- Input error This happens because we miss to add support for lowercase hex numbers, we will add it soon... 00AB yields an invalid result due to being interpreted as an octal(0)*hex(AB), those cases would be also address in an upcoming patch.
A possibly relevant merge request was started @ https://invent.kde.org/utilities/kcalc/-/merge_requests/112
Git commit a3899070820aa5166d76767a05dd16fd62c9a006 by Gabriel Barrantes. Committed on 29/06/2024 at 22:20. Pushed by gabrielbarrantes into branch 'master'. GIT_SILENT Add support for lowercase hex knumbers Add support for lowercase hex numbers in the knumber library. Also, add some miscellaneous tests. M +1 -1 knumber/knumber.cpp M +16 -0 knumber/tests/knumbertest.cpp https://invent.kde.org/utilities/kcalc/-/commit/a3899070820aa5166d76767a05dd16fd62c9a006
A possibly relevant merge request was started @ https://invent.kde.org/utilities/kcalc/-/merge_requests/115
Git commit f92b33201fc02248f46b4762f49dc1544a24f60a by Gabriel Barrantes. Committed on 05/07/2024 at 17:02. Pushed by gabrielbarrantes into branch 'master'. Add parsing support for lower case hex numbers M +9 -0 autotests/kcalc_parser_core_test.cpp M +37 -13 kcalc_parser.cpp M +11 -0 kcalc_parser.h https://invent.kde.org/utilities/kcalc/-/commit/f92b33201fc02248f46b4762f49dc1544a24f60a
A possibly relevant merge request was started @ https://invent.kde.org/utilities/kcalc/-/merge_requests/117
Git commit 03d25ed2d731a3e0266395d20bd01d01fd41a2c0 by Gabriel Barrantes. Committed on 19/07/2024 at 19:48. Pushed by gabrielbarrantes into branch 'master'. Change octal prefix from "0" to "0o" Leading 0s will be ignored in all bases for all numeric inputs. Related: bug 487837 M +12 -4 autotests/kcalc_parser_core_test.cpp M +1 -1 kcalc_display.cpp M +8 -4 kcalc_parser.cpp M +2 -1 kcalc_parser.h https://invent.kde.org/utilities/kcalc/-/commit/03d25ed2d731a3e0266395d20bd01d01fd41a2c0
Tried with KCalc - Version 24.08.0 and this seems to work fine now. Hence, VERIFIED.
Mh, sorry to reopen but this seems not to work properly yet. If you enter: FFFFF in the line edit and hit enter the input is accepted. If you enter: ffff the input is rejected with "Input error". Is it truly intended that lowercase hex is not supported?
(In reply to Gernot Gebhard from comment #11) > Mh, sorry to reopen but this seems not to work properly yet. > If you enter: > > FFFFF > > in the line edit and hit enter the input is accepted. > If you enter: > > ffff > > the input is rejected with "Input error". > > Is it truly intended that lowercase hex is not supported? Try the lastest version , is already supported.
Created attachment 173376 [details] Screenshot showing input error for fffff I tried this with 24.08.0 which appears to be the most recent version. Did I overlook something?
(In reply to Gernot Gebhard from comment #13) > Created attachment 173376 [details] > Screenshot showing input error for fffff > > I tried this with 24.08.0 which appears to be the most recent version. > Did I overlook something? You are right, I forgot about that case because it interferes with acos, cos and others... it fails because the first character is lower case, let me fix it. Can you test it?
https://invent.kde.org/utilities/kcalc/-/merge_requests/151
(In reply to Gabriel Barrantes from comment #15) > https://invent.kde.org/utilities/kcalc/-/merge_requests/151 For that I'd need to build it right? Currently, I don't have the possibility to do that.
(In reply to Gernot Gebhard from comment #16) > (In reply to Gabriel Barrantes from comment #15) > > https://invent.kde.org/utilities/kcalc/-/merge_requests/151 > > For that I'd need to build it right? Currently, I don't have the possibility > to do that. ok, I will push it as a hot fix either way.
Git commit 17933a6ee0351591fb3325c7f7e76ee1daf88cbc by Gabriel Barrantes. Committed on 12/09/2024 at 18:40. Pushed by gabrielbarrantes into branch 'master'. Support hex numbers that start with a letter (a-f) When entering numbers like 'ce' some ambiguity arises because this could be interpreted as 'light speed times euler's number' or as '0xce'. To resolve this decide based on wheter the calculator is in Numeral System mode or not. M +38 -0 autotests/kcalc_parser_core_test.cpp M +8 -0 kcalc.cpp M +23 -0 kcalc_parser.cpp M +6 -0 kcalc_parser.h https://invent.kde.org/utilities/kcalc/-/commit/17933a6ee0351591fb3325c7f7e76ee1daf88cbc