Changed gnc:computeInterestIncrement to directly calculate the amount of interest accrued in the specified compounding period. Bug 797195.

This commit is contained in:
thetedmunds 2019-04-15 13:16:32 -07:00
parent fc355958b8
commit 9afc856c20

View File

@ -63,12 +63,9 @@
;; formula from http://www.riskglossary.com/articles/compounding.htm ;; formula from http://www.riskglossary.com/articles/compounding.htm
(* a (expt (+ 1 (/ r n)) (* n t)))) (* a (expt (+ 1 (/ r n)) (* n t))))
(define (gnc:computeInterestIncrement amount interest periods i) (define (gnc:computeInterestIncrement pv ann-rate compounds period)
(let ((thisVal (gnc:futureValue amount interest periods i)) (let ((rate (/ ann-rate compounds)))
(prevVal (gnc:futureValue amount interest periods (- i 1)))) (* rate (* pv (expt (+ 1 rate) (- period 1))))))
(- thisVal prevVal)
)
)
;;;;; ;;;;;
;; below: not-exposed/"private" functions, used by the "public" functions ;; below: not-exposed/"private" functions, used by the "public" functions