PC-1211, PC-1250, etc. TVM
|
06-04-2024, 12:26 AM
(This post was last modified: 06-04-2024 12:51 AM by robve.)
Post: #17
|
|||
|
|||
RE: PC-1211, PC-1250, etc. TVM
I flipped the test lines 35 and 36 to avoid an issue when retrying. The point is really about picking a better rate when reasonably possible:
34 IF SGN Y=SGN W IF ABS Y<ABS W GOTO 33 35 IF Y<>0 IF W<>0 IF G LET G=0 : GOTO 33 36 IF ABS Y>ABS W LET I=V 37 RETURN I actually also played a bit with the idea of a weighted average, something like: 35 IF Y<>0 IF W<>0 IF G LET G=0 GOTO 33 36 IF Y<>0 OR W<>0 IF SGN Y<>SGN W LET I=(I*ABS Y+V*ABS W)/(ABS Y+ABS W) 37 RETURN But it's not working as well as I had expected. Note that SHARP IF ... IF ... LET is more efficient and faster than IF ... AND ... LET. EDIT: OK, just after writing this I see right away why it's not working well: if Y=0 then I=V when I should be picked. Duh... So it should be: 36 IF SGN Y<>SGN W LET I=(I*ABS W+V*ABS Y)/(ABS Y+ABS W) and maybe get rid of the extra iteration, although I get better results for some cases with it, such as I%=80 for PMT=-400 which is spot on. - Rob "I count on old friends to remain rational" |
|||
« Next Oldest | Next Newest »
|
User(s) browsing this thread: 20 Guest(s)