Post Reply 
HP 50g Binary Number Formatting
04-23-2022, 11:42 PM
Post: #5
RE: HP 50g Binary Number Formatting
A somewhat different approach:

Code:

\<< \->STR 3. OVER SIZE 1. - SUB    @ Clean up binary string
  0. SWAP                           @ Initialize counter
  WHILE DUP SIZE                    @ Any bits left?
  REPEAT DUP 1. 4. SUB " " + UNROT  @ First 4 bits plus space
    5. OVER SIZE SUB                @ Rest of string
    SWAP 1. + SWAP                  @ Increment counter
  END DROP \->LIST "" + \GSLIST     @ Concatenate substrings
  1. OVER SIZE 1. - SUB             @ Remove final space
\>>

Note that the string in line 4 is one space, and the string in line 7 is an empty string. The reason for the empty string in line 7 is that \GSLIST (Sigma-list) can't handle lists with less than two elements.
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 - John Keith - 04-23-2022 11:42 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 - 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)