Post Reply 
hp35s tell if variable is vector or complex
06-18-2016, 11:01 PM
Post: #1
hp35s tell if variable is vector or complex
Is there a way to tell if a register is holding a vector or a complex number?

Also I remember there was a thread on if you could tell how many dimensions a vector had and the consensus was that you could not. Has anyone figured out a solution to that problem?
Find all posts by this user
Quote this message in a reply
06-21-2016, 12:45 AM (This post was last modified: 06-21-2016 01:17 AM by dalupus.)
Post: #2
RE: hp35s tell if variable is vector or complex
or is there a way to tell if a number is complex or not?

And obviously I mean I am wondering if I can tell inside of a program.
Find all posts by this user
Quote this message in a reply
06-27-2016, 01:41 PM
Post: #3
RE: hp35s tell if variable is vector or complex
This would require user input, but maybe can help:

VIEW var
SF 10
"COMPLEX? Y=1, N=0"
CF 10
INPUT I // or other dummy variable
x=0?
GTO (label-line number) // If var isn't complex
GTO (label-line number) or next command if var is complex

I was going to suggest using the square root key, but using the square root key on a complex number on the 35S causes an error (silly in IMHO). I have no idea how to mitigate error messages.
Visit this user's website Find all posts by this user
Quote this message in a reply
06-27-2016, 04:01 PM
Post: #4
RE: hp35s tell if variable is vector or complex
(06-27-2016 01:41 PM)Eddie W. Shore Wrote:  This would require user input, but maybe can help:

VIEW var
SF 10
"COMPLEX? Y=1, N=0"
CF 10
INPUT I // or other dummy variable
x=0?
GTO (label-line number) // If var isn't complex
GTO (label-line number) or next command if var is complex

I was going to suggest using the square root key, but using the square root key on a complex number on the 35S causes an error (silly in IMHO). I have no idea how to mitigate error messages.

Yes, thanks for the reply. I had a mix of vectors and complex on the stack which I wanted to process, which is why I didn't simply create 2 versions of the program.

Basically I have items in the X Y and Z registers. Each of which could be a complex or vector. I resorted to simply have a utility which does the conversion and staying in all complex for this case.
Find all posts by this user
Quote this message in a reply
Post Reply 




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