After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 769746 - Zero interest loan formula fails - An error occurred while processing pmt
Zero interest loan formula fails - An error occurred while processing pmt
Status: RESOLVED FIXED
Product: GnuCash
Classification: Other
Component: Scheduled Transactions
2.6.4
Other Linux
: Normal normal
: ---
Assigned To: gnucash-core-maint
gnucash-core-maint
Depends on:
Blocks:
 
 
Reported: 2016-08-11 14:45 UTC by R S Prigan
Modified: 2018-06-29 23:50 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description R S Prigan 2016-08-11 14:45:55 UTC
When setting up a loan using druid, and using 0 (zero) for interest rate, resultant formula includes 0.00001
Hence calculations produce errors.

When attempting to change formula, ERROR returned:
An error occurred while processing pmt( 0 : 60.00 : 50,000.00 : 0 : 0 ).

formula lines by default:
payment 	pmt( 0.00001 / 12.00 : 60.00 : 50,000.00 : 0 : 0 )
principal	ppmt( 0.00001 / 12.00 : i : 60.00 : 50,000.00 : 0 : 0 )
interest	ipmt( 0.00001 / 12.00 : i : 60.00 : 50,000.00 : 0 : 0 )

attempts to change all FAIL - examples:
payment 	pmt( 0.00000 / 12.00 : 60.00 : 50,000.00 : 0 : 0 )
payment 	pmt( 0 / 12.00 : 60.00 : 50,000.00 : 0 : 0 )
payment 	pmt( 0 : 60.00 : 50,000.00 : 0 : 0 )
Comment 1 John Ralls 2016-09-11 23:41:41 UTC
That's because the pmt functions divide by the interest rate, and as you probably know dividing by zero is an error.

There's no reason to use the load druid for a zero-interest loan: ipmt = 0 and pmt = ppmt = principal/periods. I suppose we could add special-case code to the druid to do that, but it seems silly and a waste of time.

Unless you can make a really good case to the contrary I'm inclined to close this as "won't fix".
Comment 2 Geert Janssens 2016-09-13 07:53:47 UTC
We may not have to special case the calculation code but we could return a better error message, suggesting for a 0% rate loan you can just as well create a straightforward SX. That's less work, yet more user friendly.
Comment 3 John Ralls 2016-09-14 00:29:27 UTC
We'd still need to add special case the code. The current minimum of .001% is imposed by the irate_spin control. Editing the payment formula on the third page doesn't actually do anything and while it is read the value is ignored so we should make it not editable.

To do anything about this we'd need to change the minimum of irate_spin then check if it's zero and raise an error dialog -- and then set the rate to .001% anyway to prevent an SX crash later.

Alternatively we could just leave it alone and put a tooltip on irate_spin saying that it's not able to handle rates below .001%.

ISTM that any further discussion of why one can't have a 0 interest rate should go in the documentation. There's currently a very basic page about the loan assistant at http://www.gnucash.org/docs/v2.6/C/gnucash-help/trans-sched-loans.html; the Loans chapter in the Guide is about setting up the appropriate accounts and using the Loan Calculator.
Comment 4 Geert Janssens 2016-09-14 07:04:07 UTC
Thanks for the analysis. I agree to all points.
Comment 5 John Ralls 2016-09-15 22:05:03 UTC
I've disabled the editing of the amount_ent GtkEntry and added the following tooltip to irate_spin: "Enter the annual interest rate in percent. Accepts values from 0.001 - 100. The Mortgage Assistant does not support zero-interest loans." I've added similar documentation to the Mortgage Assistant's help page along with a brief explanation of how to create a zero-interest repayment scheduled transaction.
Comment 6 John Ralls 2018-06-29 23:50:34 UTC
GnuCash bug tracking has moved to a new Bugzilla host. This bug has been copied to https://bugs.gnucash.org/show_bug.cgi?id=769746. Please update any external references or bookmarks.