Bug 154475

Summary: kcalc shows a 2 commas as result
Product: [Applications] kcalc Reporter: Michael Braun <charlysnews>
Component: generalAssignee: Klaus Niederkrüger <kniederk>
Status: RESOLVED DUPLICATE    
Severity: normal    
Priority: NOR    
Version: unspecified   
Target Milestone: ---   
Platform: Mandriva RPMs   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:
Attachments: kcalc.png

Description Michael Braun 2007-12-22 16:21:07 UTC
Version:            (using KDE KDE 3.97.0)
Installed from:    Mandriva RPMs

I want to get the result of "8800 / 1024" and kcalc shows as result "8,,59375". Attached is a screenshot which shows the result.
Comment 1 Michael Braun 2007-12-22 16:22:17 UTC
Created attachment 22651 [details]
kcalc.png
Comment 2 Markus Grob 2008-02-28 21:56:57 UTC
I have the same with KCalc 2.2 in KDE 4.0.1. If you change the language settings in KDE, you will see, that one "," will change too, if you change the sign for the tousands. I think, one is wrong and the other "," is wrong too, because I have the "." for separting the decimals.
Don't know, from where kcalc takes this signs.
Comment 3 Markus Grob 2008-02-28 22:55:08 UTC
I think, I know, which bug this is. The 2 commas come from 2 different things. 1 is the decimal separator and one is the separator from the tousands, but it is implemented in a wrong way, i think.

If I have read the code in a right way, the separator position is set at the 3 position from right and so on. The problem is, it is counted real from right. It is not shown, if the numbers are separated with decimals.

I think, the solution is at follows:

- get position of decimalseparator
- Insert a tousendseparator to the left side all 3 numbers until the left end of string is reached
- Insert a space to the right side all 3 numbers until the right side of the string is reached.

This produces the following:

1'234'567.890 123 45

If liked, this isn't hardcoded then could be taken from lokal or from the kcalc menu. This, because the sign for the tousends isn't the same as for separating the digits after a wished position.

If possible, you could change the background every 3 numbers from the decimal separator at the left and right side. In this way, you don't need to take at look at the locale separator.
Comment 4 David Johnson 2008-06-11 22:17:39 UTC

*** This bug has been marked as a duplicate of 159168 ***