Return multiple values on multiple stack lines
03-13-2014, 04:04 AM
Post: #1
 ahall Junior Member Posts: 3 Joined: Mar 2014
Return multiple values on multiple stack lines
Hi all,
I've recently bought an HP Prime as a replacement for my aging 48GX. I have quite a number of small programs on the 48 that I would like to implement on the Prime.
My question is, how do I return multiple values to multiple lines on the stack (I use RPN mode)? So far, programs only return the result of the last line of code.

Here's my example, it's to calculate coordinates of the tangent point and intersection point for a conveyor belt layout. I'd like to return both TP and IP to lines 1 and 2 of the stack.

BEGIN

LOCAL TP, IP, shift, TPx, TPy, IPx, IPy;

// Determine of radius is concave or convex
IF alpha2 > alpha1 THEN shift:=270
ELSE
shift:= 90
END;

// Determine coordinates of the tangent point and the intersection points
IPx:= (TPy-TAN(alpha2)*TPx)/(TAN(alpha1)-TAN(alpha2));
IPy:=IPx*TAN(alpha1);

// Return the values to the stack
TP:=(TPx,TPy);
IP:=(IPx,IPy);

END;

any help appreciated,
Andrew
 « Next Oldest | Next Newest »

 Messages In This Thread Return multiple values on multiple stack lines - ahall - 03-13-2014 04:04 AM RE: Return multiple values on multiple stack lines - JimS - 03-13-2014, 06:15 AM RE: Return multiple values on multiple stack lines - ahall - 03-13-2014, 06:27 AM

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