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





Post Reply 
HP-42s Entering 4 complex numbers on the stack
05-28-2023, 09:42 AM (This post was last modified: 05-28-2023 09:45 AM by Vincent Weber.)
Post: #1
HP-42s Entering 4 complex numbers on the stack
A common reproach made to the 42S is that its complex numbers implantation, while being one the best, does not allow to enter 4 complex numbers on the stack in the row, since 2 stack levels are needed to create a complex number (as opposed to the 15c which has a parallel imaginary stack, or to the 35S that allows one-line entry).

To solve this, various solutions have been suggested, generally consumming registers or variables.

I have thought of a simple solution with no variables consumption: just enter the 4 complex numbers in a 1x4 complex matrix. If CSTK is such a matrix, then the following little program populates the stack with the 4 numbers, et voilà. What do you think?

00 { 30-Byte Prgm }
01▸LBL "CPX"
02 INDEX "CSTK"
03 RCLEL
04 I+
05 RCLEL
06 I+
07 RCLEL
08 I+
09 RCLEL
10 RTN
11 END
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
HP-42s Entering 4 complex numbers on the stack - Vincent Weber - 05-28-2023 09:42 AM



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