(11C) TVM for HP-11C
|
12-05-2020, 03:46 AM
(This post was last modified: 06-16-2021 01:22 PM by Albert Chan.)
Post: #12
|
|||
|
|||
RE: (11C) TVM for HP-11C
A faster version of guess_i(), replaced sqrt() by its Pade approximation
This is also safer, avoided sqrt of negative number issue. Code: function guess_i(n, pv, pmt, fv) -- cash-flow sign convention lua> guess_i(12, 5000, -500, 0) 0.029199705714052143 lua> guess_i(12, 0, -400, 5000) 0.007391911604953607 Update: formula adjusted so fv+pv=0 will give i = pmt/fv, instead of NaN |
|||
« Next Oldest | Next Newest »
|
User(s) browsing this thread: 8 Guest(s)