Hacker News new | ask | show | jobs
by lrkrsBlurkn 642 days ago
I wonder how the NPV algo is done.

Prima facia, the way Id tackle it if I have a few extra registers is

1. Id write the exponent as n = R*m, where R is an integer. R = 2 is probably best.

2. Then Id do pascal's triangle (every element is a simple combination comb[x,y]) for the expansion of the exponent (if R = 2 binomial expansion) and add in ascending order.

3. Then raise the answer to the power of m.

Of course, I can iteratively do steps 1-2 if the interest rate is very small.

1 comments

Here's an HP article on the HP-80, a predecessor to the 12C. They describe an algorithm solving for interest rate: https://www.worldradiohistory.com/Archive-Company-Publicatio...