Post Reply 
(42S) Argument, Real Part, Imaginary Part, and Sign Function
12-29-2018, 08:50 AM
Post: #4
RE: (42S) Argument, Real Part, Imaginary Part, and Sign Function
(12-29-2018 05:48 AM)Paul Dale Wrote:  What about:

Code:
LBL "SIGN"
x=0?
STO L
x=0?
RTN
ABS
x<> L
RCL/ L
RTN

This would work if (!) the 42s allowed tests for complex numbers. ;-)
But it throws an "Invalid Type" error here.

(12-29-2018 06:35 AM)Thomas Klemm Wrote:  What about using the built-in SIGN function?

Yes, a complex sign function is not required, the built-in function works nicely. For complex arguments it even returns 0 for 0+0i. For real arguments sign(0) is returned as 1. Maybe for compatibility with the HP-41 which does it the same way. Here SIGN returns 0 only for Alpha data (!).

Dieter
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
RE: (42S) Argument, Real Part, Imaginary Part, and Sign Function - Dieter - 12-29-2018 08:50 AM



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