This forum has been archived. All content is frozen. Please use KDE Discuss instead.

Newb: AlkValue question

Tags: None
(comma "," separated)
michaela
Registered Member
Posts
1
Karma
0

Newb: AlkValue question

Fri Jan 18, 2013 10:39 am
I'm new to KDE, and just took a look at KmyMoney, and I am impressed, and will be recommending it to quicken users, as I am a pushy Linux advocate.
I've been programming business applications for 30 years, COBOL, FORTRAN, and of course in the last 10 years lots of Microsoft Technologies, including some Java and C/C++.... Not trying to build a resume here, just saying, cuz I am about to ask a fairly stupid question about KDE financial methods.

What is purpose (for example) of storing a transaction amount of say '41.46' into the database as '2073/50' ?
A very clever algorithm, love it, and I do realize that 2073/50 = 41.46 , but why not just store the '41.46' and be done with it?
Why the fraction, a requirement of "alkimia D-BUS", (AlkValue), very curious?
--
Thanks in advance,
Michaela.
cristian.onet
KDE Developer
Posts
253
Karma
2
OS

Re: Newb: AlkValue question

Fri Jan 18, 2013 10:48 am
Why the fraction, a requirement of "alkimia D-BUS", (AlkValue), very curious?

To maintain precision when performing calculations (the first of The ultimate objectives of KMyMoney).

Think of this amount 1/3 which equals 0.(3). Now you can store 0.3333 (etc) but you will loose precision when a lot of these amounts are passed trough arithmetic operations.
Code: Select all
3*0.3333 = 0.9999

while
Code: Select all
3*1/3 = 1


cristian.onet, proud to be a member of KDE forums since 2008-Oct.
cristian.onet
KDE Developer
Posts
253
Karma
2
OS

Re: Newb: AlkValue question

Fri Jan 18, 2013 10:51 am
By the way we use http://gmplib.org/ to obtain the arbitrary precision arithmetic.


cristian.onet, proud to be a member of KDE forums since 2008-Oct.
User avatar
Hei Ku
Registered Member
Posts
784
Karma
3
OS

Re: Newb: AlkValue question

Fri Jan 18, 2013 10:52 am
michaela wrote:Why the fraction, a requirement of "alkimia D-BUS", (AlkValue), very curious?


Just to be precise, AlkValue is part of libAlkimia, not Alkimia DBus, which was part of the whole Alkimia "initiative" but is unmaintained at the moment and not required for KMyMoney at all.


Hei Ku, proud to be a member of the KMyMoney Development Team since January-2008


Bookmarks



Who is online

Registered users: bartoloni, Bing [Bot], Evergrowing, Google [Bot], ourcraft