Post Reply 
Printing to stack for free42/plus42
11-06-2023, 01:17 PM
Post: #1
Printing to stack for free42/plus42
Good afternoon/morning to everyone.

I have a question that I feel is trivial but I have not been able to find a clear answer/example for.
I want to calculate a quantity and then based in that print to the stack several values based on that quantity I.e 60% of the quantity 70% of the quantity and so on with a label for each line.
Is there a straightforward way to do that? In most programming languages we can do string interpolation and produce formatted strings.
Is there a way to do that with rpn?

Thank you very much
Find all posts by this user
Quote this message in a reply
11-06-2023, 02:23 PM (This post was last modified: 11-06-2023 02:31 PM by Eddie W. Shore.)
Post: #2
RE: Printing to stack for free42/plus42
On the HP 42S family, the stack can only hold alpha strings up to six characters. ASTO stores the first six characters of the alpha string to the stack or a variable.

We could be looking at, something like:

Z: "60°/.="
T: 60% of the number
Y: "70°/.="
X: 70% of the number
(pause... do the next pair of calculations)

There is no % character in alpha, so I have to construct it in three characters.

- - - - -

Here is a program that uses the print-out feature which can print out multiple answers with labels. (but not to the stack itself)

QUANTITY?
180 ***
60°/.= 108.16218
70°/.= 126.16218
80°/.= 144.16218
90°/.= 162.16218


Code:
00 { 59-Byte Prgm }
01▸LBL "PER"
02 PRON              # turns the printer ON, PRINTER menu, 3rd row, labeled PON
03 60.09010        # I'm going from 60% to 90% in increments of 10%
04 STO 01
05 "QUANTITY?"
06 PRA                # PRA:  print the Alpha Stack
07 PROMPT
08 STO 02
09 PRX                   # PRX:  print the X stack
10▸LBL 01
11 CLA
12 RCL 01
13 IP
14 ARCL ST X
15 ├"°/.= "
16 RCL 02
17 RCL 01
18 %
19 ARCL ST X
20 AVIEW                    # when printer is on AVIEW prints to the print-out
21 PSE
22 ISG 01
23 GTO 01
24 .END.


Sample print out:

Code:
QUANTITY?
              180    ***
60°/.= 108.16218
70°/.= 126.16218
80°/.= 144.16218
90°/.= 162.16218

Hope this helps.
Visit this user's website Find all posts by this user
Quote this message in a reply
11-06-2023, 02:39 PM
Post: #3
RE: Printing to stack for free42/plus42
(11-06-2023 02:23 PM)Eddie W. Shore Wrote:  There is no % character in alpha, so I have to construct it in three characters.

It's right there on the keyboard? shift-RCL

Werner

41CV†,42S,48GX,49G,DM42,DM41X,17BII,15CE,DM15L,12C,16CE
Find all posts by this user
Quote this message in a reply
11-06-2023, 02:40 PM
Post: #4
RE: Printing to stack for free42/plus42
(11-06-2023 02:23 PM)Eddie W. Shore Wrote:  On the HP 42S family, the stack can only hold alpha strings up to six characters. ASTO stores the first six characters of the alpha string to the stack or a variable.

We could be looking at, something like:

Z: "60°/.="
T: 60% of the number
Y: "70°/.="
X: 70% of the number
(pause... do the next pair of calculations)

There is no % character in alpha, so I have to construct it in three characters.

- - - - -

Here is a program that uses the print-out feature which can print out multiple answers with labels. (but not to the stack itself)

QUANTITY?
180 ***
60°/.= 108.16218
70°/.= 126.16218
80°/.= 144.16218
90°/.= 162.16218


Code:
00 { 59-Byte Prgm }
01▸LBL "PER"
02 PRON              # turns the printer ON, PRINTER menu, 3rd row, labeled PON
03 60.09010        # I'm going from 60% to 90% in increments of 10%
04 STO 01
05 "QUANTITY?"
06 PRA                # PRA:  print the Alpha Stack
07 PROMPT
08 STO 02
09 PRX                   # PRX:  print the X stack
10▸LBL 01
11 CLA
12 RCL 01
13 IP
14 ARCL ST X
15 ├"°/.= "
16 RCL 02
17 RCL 01
18 %
19 ARCL ST X
20 AVIEW                    # when printer is on AVIEW prints to the print-out
21 PSE
22 ISG 01
23 GTO 01
24 .END.


Sample print out:

Code:
QUANTITY?
              180    ***
60°/.= 108.16218
70°/.= 126.16218
80°/.= 144.16218
90°/.= 162.16218

Hope this helps.

Hi Eddie,
Yes this is very close to what i need. In my case my printer is always on because i want to keep a log of all my calculations, so this would work quite well.

Thanks you very much
Find all posts by this user
Quote this message in a reply
11-06-2023, 05:56 PM (This post was last modified: 11-06-2023 05:57 PM by Nigel (UK).)
Post: #5
RE: Printing to stack for free42/plus42
Unlike the HP42S, Free42 does support unlimited length strings. It’s worth looking at the string and list extensions documentation here to see what’s available.

Nigel (UK)
Find all posts by this user
Quote this message in a reply
11-07-2023, 12:00 AM
Post: #6
RE: Printing to stack for free42/plus42
(11-06-2023 05:56 PM)Nigel (UK) Wrote:  Unlike the HP42S, Free42 does support unlimited length strings. It’s worth looking at the string and list extensions documentation here to see what’s available.

Nigel (UK)

Cheers, in this case the string length I want to print is even within the original 42s rest.
Find all posts by this user
Quote this message in a reply
11-07-2023, 03:32 AM
Post: #7
RE: Printing to stack for free42/plus42
(11-06-2023 02:39 PM)Werner Wrote:  
(11-06-2023 02:23 PM)Eddie W. Shore Wrote:  There is no % character in alpha, so I have to construct it in three characters.

It's right there on the keyboard? shift-RCL

Werner

Thanks, Werner! I was looking all over for it in the Alpha menus.
Visit this user's website Find all posts by this user
Quote this message in a reply
Post Reply 




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