Best Pol/Rect and Complex Number Decomp for 35S

01262019, 04:23 PM
(This post was last modified: 01262019 04:47 PM by Dieter.)
Post: #7




RE: Best Pol/Rect and Complex Number Decomp for 35S
(01262019 01:04 PM)rprosperi Wrote: ...if you look closely you'll see these routines preserve the stack (incl LastX) and flags... Yes for the stack and flags, but No regarding LastX. Which is not preserved – on exit it contains a complex number or a vector, respectively. But it can be done. The following modified versions also preserve LastX: Code: P001 LBL P The R routine is even one step shorter. ;) Equations in programs really are a nice feature of the 35s. They simply return the result in X and push the stack by one level, while no other stack registers – including LastX – are affected. So these programs simply move the original X to LastX (by means of the ABS command in line 004) before they finally return the two results in Y and X. For those who are not that familiar with the 35s equation mode: REGZ and REGT are entered by pressing the [R↓] key and then selecting the respective register X, Y, Z or T from the menu. Stack diagram for →P: Code: T: t t Stack diagram for →R: Code: T: t t Finally, if the state of flag 10 does not have to be preserved the code can be even shorter. In this case remove line 011...014 and replace line 002...003 with "CF 10". Dieter 

« Next Oldest  Next Newest »

User(s) browsing this thread: 1 Guest(s)