newRPL - build 1255 released! [updated to 1299]
|
11-20-2019, 04:59 PM
(This post was last modified: 11-20-2019 05:11 PM by Claudio L..)
Post: #607
|
|||
|
|||
RE: newRPL - build 1255 released! [updated to 1299]
(11-20-2019 04:47 AM)The Shadow Wrote: I started using HP calculators with the 48, so I'm not familiar with old-school RPN. Are the assembly-like instructions primarily useful for RPN users, or do they have uses in RPL? Assembly-like instructions are for everybody. They intermix with RPL as you wish. You can think of the registers as local variables that don't need to be declared, or as temporary storage to avoid (or reduce) stackrobatics. I think that's the main usefulness: Reduce stackrobatics and cryptic code by making things more readable. The instructions are quite compact, think << :A+=B*C >> and compare with << B C * 'A' STO+ >>, so code is shorter and easier to read. Yes, there's a slight reduction in the overhead of running 1 command versus 5, so speed could end up improving (not tested yet as it wasn't the objective). On the other hand, the interpreter overhead is pretty thin as it is, so the improvement in speed won't be that impressive. However, readability of numerical algorithms I think will improve significantly. It's easy to get lost in stackrobatics and these instructions can help keep the code clean. An example: Given A, B, C on the stack, calculate the quadratic formula (-B+√(B^2-4*A*C))/(2*A) I know, using a symbolic then ->NUM it's best for readability but for the sake of this excercise let's not use symbolics. Using stackrobatics: Code:
Using assembly-like code: Code:
There's 15 objects and commands on the stackrobatics version, vs. only 9 instructions in the assembly-like and it is more readable, once you get used to the syntax. RPN people should find more at home with the assembly-like syntax than with plain RPL, but that doesn't prevent RPL people from using it too. EDIT: A third way to code it, using locals: Code:
|
|||
« Next Oldest | Next Newest »
|
User(s) browsing this thread: 11 Guest(s)