Bug 489027

Summary: Doesn't subtract percentages correctly
Product: [Applications] kcalc Reporter: cinman71481 <cinman71481>
Component: generalAssignee: Gabriel Barrantes <gabriel.barrantes.dev>
Status: RESOLVED FIXED    
Severity: minor CC: answer2019, fanzhuyifan, flyingwaffle, gabriel.barrantes.dev, hammerschaedel, kayzzen01, mirsch, rondo.sp, screen-rind-whoops, stefan.annoni
Priority: HI Keywords: regression
Version: 24.05.0   
Target Milestone: ---   
Platform: Other   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:

Description cinman71481@gmail.com 2024-06-23 07:36:43 UTC
Kcalc gives me a incorrect awnser whenever I am trying to subtract a number by a percenatge.

Example #1 - 1600 - 20%
Gnome Calculator and Android Calculator = 1280
Kcalc = 1599.8

Example #2 - 1985 - 19.2%
Gnome/Android Calc = 1603.88
Kcalc 1984.808

Example #3 - 2580.25 - 32.98%
Gnome/Android Calc = 1729.28355
Kcalc = 2579.9802
Comment 1 fanzhuyifan 2024-06-24 01:51:23 UTC
Also different from google calculator, and wolfram alpha. IMO we should be consistent with the major calculators.
Comment 2 Stefano 2024-07-01 19:59:46 UTC
The same applies for percentage additions (also in version 24.05.1):
10+20%=10.2 instead of 12
Comment 3 Bug Janitor Service 2024-07-06 18:47:46 UTC
A possibly relevant merge request was started @ https://invent.kde.org/utilities/kcalc/-/merge_requests/116
Comment 4 Gabriel Barrantes 2024-07-09 20:16:13 UTC
Git commit d962db84549160c2eb7196f0a2eba06a0fe93616 by Gabriel Barrantes.
Committed on 06/07/2024 at 18:44.
Pushed by gabrielbarrantes into branch 'master'.

Add "add/subtract percentage" functionality

M  +20   -1    autotests/kcalc_parser_core_test.cpp
M  +40   -0    kcalc_core.cpp
M  +1    -0    kcalc_core.h

https://invent.kde.org/utilities/kcalc/-/commit/d962db84549160c2eb7196f0a2eba06a0fe93616
Comment 5 Gabriel Barrantes 2024-07-11 16:19:16 UTC
*** Bug 490111 has been marked as a duplicate of this bug. ***
Comment 6 Gabriel Barrantes 2024-07-16 02:39:53 UTC
*** Bug 490329 has been marked as a duplicate of this bug. ***
Comment 7 Gabriel Barrantes 2024-07-16 14:29:24 UTC
*** Bug 490355 has been marked as a duplicate of this bug. ***
Comment 8 Gabriel Barrantes 2024-07-23 14:20:17 UTC
*** Bug 490696 has been marked as a duplicate of this bug. ***
Comment 9 duha.bugs 2024-08-15 23:39:31 UTC
*** Bug 491766 has been marked as a duplicate of this bug. ***
Comment 10 Filip 2024-08-24 08:37:23 UTC
*** Bug 492115 has been marked as a duplicate of this bug. ***