Post Reply 
HP 50g Binary Number Formatting
04-25-2022, 03:22 PM
Post: #11
RE: HP 50g Binary Number Formatting
(04-24-2022 10:40 AM)3298 Wrote:  As do the majority of good RPL programs, because in most cases variables are both bulkier and slower.

Such antiquated concept... newRPL variables are often faster than the stack.

Anyway, here's my take in newRPL dialect:

Code:

«
  → N 
  « 
    ""                          @@ START WITH AN EMPTY STRING
    DO
      #10000b N #Fh BAND +      @@ ISOLATE 4 BITS, TURN THE 5TH BIT ON TO GET ALL 4 DIGITS
      →STR 3 6 SUB              @@ CONVERT TO STRING "#1xxxxb" AND EXTRACT THE 4 DIGITS
      SWAP +                    @@ PREPEND TO THE ORIGINAL STRING
      N 4 BLSR 'N' STO          @@ ROTATE 4 BITS TO THE RIGHT TO GET THE NEXT DIGIT
      IF N THEN " " SWAP + END  @@ PREPEND A SPACE IF THERE ARE ANY MORE NONZERO DIGITS
    UNTIL  
        N NOT                   @@ END THE LOOP WHEN NO MORE NONZERO DIGITS
   END
  »
»
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
HP 50g Binary Number Formatting - aaron - 04-20-2022, 05:47 PM
RE: HP 50g Binary Number Formatting - Gil - 04-23-2022, 01:38 PM
RE: HP 50g Binary Number Formatting - Gil - 04-23-2022, 06:01 PM
RE: HP 50g Binary Number Formatting - Gil - 04-23-2022, 06:50 PM
RE: HP 50g Binary Number Formatting - Gil - 04-24-2022, 12:03 AM
RE: HP 50g Binary Number Formatting - 3298 - 04-24-2022, 10:40 AM
RE: HP 50g Binary Number Formatting - Claudio L. - 04-25-2022 03:22 PM
RE: HP 50g Binary Number Formatting - Gil - 04-24-2022, 11:34 AM
RE: HP 50g Binary Number Formatting - Gil - 04-25-2022, 04:04 PM
RE: HP 50g Binary Number Formatting - Gil - 04-25-2022, 10:34 PM



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