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

overflow in Investments

Tags: None
(comma "," separated)
azlev
Registered Member
Posts
3
Karma
0
OS

overflow in Investments

Tue Sep 07, 2010 10:32 pm
Hi all.

I have an asset investment which I can buy stocks.

Both stock price and stock quantity uses 1/100000000 fractions.

I've lost 3 hours before realize that numbers are wrong because an arithmetic overflow.

Why not use an object with arbitrary precision to denote money?
User avatar
Hei Ku
Registered Member
Posts
784
Karma
3
OS

Re: overflow in Investments

Wed Sep 08, 2010 12:05 am
Now you know. The secret is out. :(

Bug 245214 on bugs.kde.org says we are guilty as charged.

But even one simple object with arbitrary precision has a limit. You actually have to use 2 of such objects, to account for rational numbers. ;)

Help is welcome.


Hei Ku, proud to be a member of the KMyMoney Development Team since January-2008
kaduardo
Registered Member
Posts
15
Karma
0
OS

Re: overflow in Investments

Thu Sep 09, 2010 7:59 pm
Hi all,

I have just finished to implement a fix for this problem.

I am just running some other tests before I submit it to Reviewboard.
azlev
Registered Member
Posts
3
Karma
0
OS

Re: overflow in Investments

Sat Sep 11, 2010 3:49 pm
Hi kaduardo.

Can you publish this patch somewhere? I can help with the tests, since I have 3 investments that triggers this bug.

Thanks.
kaduardo
Registered Member
Posts
15
Karma
0
OS

Re: overflow in Investments

Sat Sep 11, 2010 8:24 pm
Patch published in reviewboard.

I found a problem when creating a new object using the String constructor.

If I create a new object with the value of "0.08" or "0.09" it doesn't work.
However, it does work for "0.07".
I have included some new tests in the mymoneymoneytest.cpp file (testStringConstructor method) for showing this.

Any help is appreciated, since I am not proficient with C++.
kaduardo
Registered Member
Posts
15
Karma
0
OS

Re: overflow in Investments

Sun Oct 03, 2010 6:34 pm
Hi guys,

Just an update.

The patch in ReviewBoard now contains all fixes in libalkimia.

I have been using this version in my files without any problems.

Can anyone give it a try just to check if I missed something?
peterjames
Registered Member
Posts
1
Karma
0

Re: overflow in Investments

Fri Dec 10, 2010 12:00 pm
Hi kaduardo.

Really great nice questions but one think Can you publish this patch somewhere? I can help with the tests, since I have 3 investments that triggers this bug because i hv no basic idea on this. Thank Buddy.....
cristian.onet
KDE Developer
Posts
253
Karma
2
OS

Re: overflow in Investments

Fri Dec 10, 2010 12:12 pm
peterjames wrote:Hi kaduardo.

Really great nice questions but one think Can you publish this patch somewhere? I can help with the tests, since I have 3 investments that triggers this bug because i hv no basic idea on this. Thank Buddy.....


For testing that patch (which is in reviewboard by the way) you would also need to install libalkimia which wasn't released yet and it's currently in kdereview in the KDE SVN. That would be a bit difficult if you're not familiar with building software yourself.
The plan is to release libalkimia somewhere in January and to release KMyMoney 4.6 (using libalkimia) after that.


cristian.onet, proud to be a member of KDE forums since 2008-Oct.
kaduardo
Registered Member
Posts
15
Karma
0
OS

Re: overflow in Investments

Fri Dec 10, 2010 12:18 pm
cristian.onet wrote:
peterjames wrote:Hi kaduardo.

Really great nice questions but one think Can you publish this patch somewhere? I can help with the tests, since I have 3 investments that triggers this bug because i hv no basic idea on this. Thank Buddy.....


For testing that patch (which is in reviewboard by the way) you would also need to install libalkimia which wasn't released yet and it's currently in kdereview in the KDE SVN. That would be a bit difficult if you're not familiar with building software yourself.
The plan is to release libalkimia somewhere in January and to release KMyMoney 4.6 (using libalkimia) after that.
As Cristian mentioned, the patch is in Reviewboard.

I have included libalkimia in the patch, although I have to update it with to the latest version, and include the latest changes in the patch.

I will update the patch tonight (the code is in my home pc) and post in this forum to let you know.
azlev
Registered Member
Posts
3
Karma
0
OS

Re: overflow in Investments

Fri Dec 10, 2010 11:51 pm
Hi all.

peterjames, if you want some help, you can ask me too. I'm testing kaduardo's patch for more than a month and everthing is fine. I installed the patched version in my system and gave up the distro package (Fedora 14). I'm very happy so far.
User avatar
ipwizard
KDE Developer
Posts
1359
Karma
6
OS

Re: overflow in Investments

Sat Dec 11, 2010 8:02 am
I am still in touch with kaduardo to finish the integration. YMMV when using the patches as we might update them now and then. But we should have it in trunk at the end of the year (yes folks, that's close). So far, the KDE review process of libalkimia is very smooth.


ipwizard, proud to be a member of the KMyMoney forum since its beginning. :-D
openSuSE Leap 15.4 64bit, KF5
kaduardo
Registered Member
Posts
15
Karma
0
OS

Re: overflow in Investments

Sun Jan 09, 2011 6:32 pm
Hello all,

I just updated the patch in reviewboard after some weeks of test using my files.

The patch still fails the test cases pivottabletest and querytabletest, and I need some help in isolating the source of these failures.

The problem is a comparison between two values in different "forms" (with different denominators) which is the expected behaviour by libalkimia, but I couldn't identify where the offending value was being created in the pivotable class.
I have added some debug lines in the pivottabletest showing the values.

Any help is appreciated.


Bookmarks



Who is online

Registered users: abc72656, Bing [Bot], daret, Google [Bot], lockheed, Sogou [Bot], Yahoo [Bot]