mirror of
https://github.com/Gnucash/gnucash.git
synced 2025-02-25 18:55:30 -06:00
725366 - Formula Parsing Error with Scheduled Mortgage Transactions
Clamp per to nper so that the random value from gnc_sxed_check_consistent doesn't create overflows with ridiculous values.
This commit is contained in:
parent
840feccbf7
commit
8c89c1357e
@ -35,24 +35,20 @@
|
||||
(* -1 (* rate
|
||||
(- 0 (calc-principal pv
|
||||
(calc-pmt rate nper pv fv type)
|
||||
rate (- per 1)))
|
||||
))
|
||||
rate (- (if (> per nper) nper per) 1)))))
|
||||
)
|
||||
|
||||
;; principal payment amount:
|
||||
(define (gnc:ppmt rate per nper pv fv type)
|
||||
(let* ((pmt (calc-pmt rate nper pv fv type))
|
||||
(ipmt (* rate
|
||||
(calc-principal pv pmt rate (- per 1)))))
|
||||
(* -1 (-
|
||||
pmt
|
||||
(* -1 ipmt))))
|
||||
(ipmt (gnc:ipmt rate per nper pv fv type)))
|
||||
(* -1 (- pmt (* -1 ipmt))))
|
||||
)
|
||||
|
||||
;; payment amount:
|
||||
(define (gnc:pmt rate nper pv fv type)
|
||||
(* -1 (calc-pmt rate nper pv fv type)))
|
||||
|
||||
(* -1 (calc-pmt rate nper pv fv type))
|
||||
)
|
||||
|
||||
;; 2 functions from http://lists.gnucash.org/pipermail/gnucash-user/2005-February/012964.html
|
||||
;; future value of deposits with compound interests:
|
||||
|
Loading…
Reference in New Issue
Block a user