Post Reply 
Which systems support a COMPLEX data type?
07-14-2023, 04:02 PM
Post: #19
RE: Which systems support a COMPLEX data type?
(07-14-2023 02:55 PM)KeithB Wrote:  
(07-14-2023 01:15 PM)johnb Wrote:  Agreed.

In fact, any language that supports basic math functions, user libraries of some type, and
Just my $0.02 worth.

The criteria was: "(Here, I define "support" as a notation like C1=C2*C3, not by specific functions like C1=CPXMUL(C2,C3), and also including common trig and log functions)"

Before C99 C could not do complex operations via operators. And even now, I don't know if the library can handle complex trig functions.

Sure it does https://en.wikipedia.org/wiki/C_mathemat...#complex.h

C99 standardized complex types and functions. Before C99 it was a non-standard extension supported by various compilers. That's how standards come about, usually.

A header file complex.h is included to declare the types and the explicit intent to use complex functions in your code, which is always nice to tell the world what you're doing. You can use _Complex_I for the imaginary unit, e.g. 1 + 2*_Complex_I. In case that's too verbose, just #define I _Complex_I or if you're an engineer Big Grin then #define J _Complex_I or something like that.

Complex arithmetic in C is performed with the standard arithmetic operators, because the complex type is a built-in type, just like float and double. Complex arithmetic in C does not require a library call, neither in the source code nor in the generated MC that just operates on floating pointer registers.

- Rob

PS. The HP Forums are great! Don't take this as crude or offense, just a bit of poking, but sometimes I feel there is a slight tendency for wishful thinking we still live in the 70s: time for everything else has stood still and can be ignored except for HP calculators Smile

"I count on old friends to remain rational"
Visit this user's website Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
RE: Which systems support a COMPLEX data type? - robve - 07-14-2023 04:02 PM



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