Post Reply 
RPL second impressions (HP 28)
06-29-2018, 05:13 PM
Post: #20
RE: RPL second impressions (HP 28)
(06-29-2018 01:08 PM)Gerson W. Barbosa Wrote:  That's one of my first RPL programs (HP-28S, back in 1987), so it can surely be optimized a bit.

Using local variables avoids stack juggling. Otherwise the changes were only minor.

Code:
«
  IF DUP 2 MOD
  THEN
    DUP √ → n r
    « 1
      DO
        2 +
      UNTIL
        r OVER <
        OVER n SWAP MOD NOT
        OR
      END
      n SWAP MOD NOT
    »
  END
  NOT
»

(06-29-2018 02:49 PM)Thomas Okken Wrote:  The resulting programs are hard to write and even harder to read.

Is that easy enough to understand?

Cheers
Thomas
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
RPL second impressions (HP 28) - mdunn - 06-27-2018, 01:19 AM
RE: RPL second impressions (HP 28) - mdunn - 06-27-2018, 01:58 PM
RE: RPL second impressions (HP 28) - mdunn - 06-27-2018, 04:06 PM
RE: RPL second impressions (HP 28) - mdunn - 06-27-2018, 05:11 PM
RE: RPL second impressions (HP 28) - mdunn - 06-27-2018, 07:45 PM
RE: RPL second impressions (HP 28) - mdunn - 06-28-2018, 08:48 PM
RE: RPL second impressions (HP 28) - Thomas Klemm - 06-29-2018 05:13 PM
RE: RPL second impressions (HP 28) - ttw - 07-04-2018, 10:52 PM



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