The following warnings occurred:
Warning [2] count(): Parameter must be an array or an object that implements Countable - Line: 795 - File: showthread.php PHP 7.4.33 (FreeBSD)
File Line Function
/showthread.php 795 errorHandler->error





Thread Closed 
Reading one or two arguments
03-13-2021, 04:18 PM
Post: #1
Reading one or two arguments
Hi,

This is my first post on this forum. I have been using a HP-48GX for some 30 years now, but that died on me a few days ago. I replaced it with a HP-Prime and try to understand the current PPL language.

On my 48GX I had a small program that allowed me to convert a vector to its two arguments and vice versa. These vectors I use a lot in land-surveying: by switching from and to polar mode I can easily convert a coordinate-pair to distance and argument and vice versa (and add sets to each other). On the Prime I can do the same using a complex in the following notation: (a,b).

Starting point is one or two arguments on the stack.
The problem I now have is that after testing the first argument on the stack I need to make a decision:
IF TYPE(Arg1) == 0... I need to read to read Arg2 and return them as complex (Arg1, Arg2)
IF TYPE(Arg1) == 3... there is only one complex argument available, all I need to do is return its length and argument to the stack.

Reading two arguments is easy, provided they are available:
EXPORT MyProg(Arg1, Arg2)

But as I do not know in advance whether I can get 1 or 2 arguments, I need to start my program as

EXPORT MyProg(Arg1)

and test Arg1 first, before reading Arg2 when TYPE(Arg1)==0.

The other problem I have is how to return two arguments to the stack...

thanks in advance for your suggestions,
Nicolàs
Find all posts by this user
Thread Closed 


Messages In This Thread
Reading one or two arguments - HillyBoy - 03-13-2021 04:18 PM
RE: Reading one or two arguments - essen - 03-13-2021, 08:40 PM
RE: Reading one or two arguments - Han - 03-14-2021, 05:20 AM
RE: Reading one or two arguments - essen - 03-14-2021, 11:54 AM
RE: Reading one or two arguments - essen - 03-14-2021, 10:08 PM
RE: Reading one or two arguments - essen - 03-15-2021, 12:27 PM
RE: Reading one or two arguments - essen - 03-16-2021, 09:00 PM
RE: Reading one or two arguments - Gene - 03-17-2021, 08:55 PM



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