1
0
mirror of https://git.savannah.gnu.org/git/emacs.git synced 2024-12-23 10:34:07 +00:00

Fix optional parameter passing in calc-fin-* functions

* lisp/calc/calc-fin.el (calc-fin-pv, calc-fin-fv, calc-fin-pmt)
(calc-fin-pner, calc-fin-rate): Add support for an optional
parameter standing for an initial lump. The functions already
support it but the extra parameter was not taken into account in
stack mode. This commit it takes into consideration when deciding
if a function takes 3 or 4 parameters (bug#37649).
This commit is contained in:
Raimon Grau 2019-10-19 11:46:17 +02:00 committed by Lars Ingebrigtsen
parent 842cc05d5c
commit ba8944bba8

View File

@ -35,9 +35,10 @@
(calc-slow-wrapper
(if (calc-is-hyperbolic)
(calc-enter-result 3 "pvl" (cons 'calcFunc-pvl (calc-top-list-n 3)))
(if (calc-is-inverse)
(calc-enter-result 3 "pvb" (cons 'calcFunc-pvb (calc-top-list-n 3)))
(calc-enter-result 3 "pv" (cons 'calcFunc-pv (calc-top-list-n 3)))))))
(let ((n (if (calc-is-option) 4 3)))
(if (calc-is-inverse)
(calc-enter-result n "pvb" (cons 'calcFunc-pvb (calc-top-list-n n)))
(calc-enter-result n "pv" (cons 'calcFunc-pv (calc-top-list-n n))))))))
(defun calc-fin-npv (arg)
(interactive "p")
@ -51,42 +52,48 @@
(calc-slow-wrapper
(if (calc-is-hyperbolic)
(calc-enter-result 3 "fvl" (cons 'calcFunc-fvl (calc-top-list-n 3)))
(if (calc-is-inverse)
(calc-enter-result 3 "fvb" (cons 'calcFunc-fvb (calc-top-list-n 3)))
(calc-enter-result 3 "fv" (cons 'calcFunc-fv (calc-top-list-n 3)))))))
(let ((n (if (calc-is-option) 4 3)))
(if (calc-is-inverse)
(calc-enter-result n "fvb" (cons 'calcFunc-fvb (calc-top-list-n n)))
(calc-enter-result n "fv" (cons 'calcFunc-fv (calc-top-list-n n))))))))
(defun calc-fin-pmt ()
(interactive)
(calc-slow-wrapper
(if (calc-is-hyperbolic)
(calc-enter-result 3 "fvl" (cons 'calcFunc-fvl (calc-top-list-n 3)))
(if (calc-is-inverse)
(calc-enter-result 3 "pmtb" (cons 'calcFunc-pmtb (calc-top-list-n 3)))
(calc-enter-result 3 "pmt" (cons 'calcFunc-pmt (calc-top-list-n 3)))))))
(let ((n (if (calc-is-option) 4 3)))
(if (calc-is-inverse)
(calc-enter-result n "pmtb" (cons 'calcFunc-pmtb (calc-top-list-n n)))
(calc-enter-result n "pmt" (cons 'calcFunc-pmt (calc-top-list-n n))))))))
(defun calc-fin-nper ()
(interactive)
(calc-slow-wrapper
(if (calc-is-hyperbolic)
(calc-enter-result 3 "nprl" (cons 'calcFunc-nperl (calc-top-list-n 3)))
(if (calc-is-inverse)
(calc-enter-result 3 "nprb" (cons 'calcFunc-nperb
(calc-top-list-n 3)))
(calc-enter-result 3 "nper" (cons 'calcFunc-nper
(calc-top-list-n 3)))))))
(let ((n (if (calc-is-option) 4 3)))
(if (calc-is-inverse)
(calc-enter-result n "nprb" (cons 'calcFunc-nperb
(calc-top-list-n n)))
(calc-enter-result n "nper" (cons 'calcFunc-nper
(calc-top-list-n n))))))))
(defun calc-fin-rate ()
(interactive)
(calc-slow-wrapper
(calc-pop-push-record 3
(if (calc-is-hyperbolic) "ratl"
(if (calc-is-inverse) "ratb" "rate"))
(calc-to-percentage
(calc-normalize
(cons (if (calc-is-hyperbolic) 'calcFunc-ratel
(if (calc-is-hyperbolic) 'calcFunc-rateb
'calcFunc-rate))
(calc-top-list-n 3)))))))
(let ((n (if (and (not (calc-is-hyperbolic))
(calc-is-option))
4 3)))
(calc-pop-push-record n
(if (calc-is-hyperbolic) "ratl"
(if (calc-is-inverse) "ratb" "rate"))
(calc-to-percentage
(calc-normalize
(cons (if (calc-is-hyperbolic) 'calcFunc-ratel
(if (calc-is-hyperbolic) 'calcFunc-rateb
'calcFunc-rate))
(calc-top-list-n n))))))))
(defun calc-fin-irr (arg)
(interactive "P")