Yes, any processor can handle a complex number, but you might
have to keep track of the real and imaginary components, depending
on what you are doing. Also the available GNU library has transcendental
functions if you want to work in complex polar. But again, you have to do the
simple math coding. Example., you want RMS of complex power, that is
very straighforward knowing the Re and Im parts of the number.
In fact you could easily write macros to implement your own specific
library of complex number calculations.
1 of 1 people found this helpful
Some links that might be of interest -
Thank danaaknight for your answer
I know that I can make my library for complex (it not complex !!!).
But I want use the C99 library.
For the compiler I add the command line "-std=gnu99"
When I write
the gcc compiler from PSoC Creator 2.1 give an error :
.\main.c:14: fatal error: complex.h: No such file or directory
the other include are Ok .
25 : _Complex float a=1.3+2.5i;
26 : sprintf(strtmp, "a = %g + %gi\n", creal(a), cimag(a));
This small program is working but with warning because compiler dont know "complex.h" and the linker is Ok
.\main.c:26: warning: implicit declaration of function 'creal'
.\main.c:26: warning: incompatible implicit declaration of built-in function 'creal'
.\main.c:26: warning: implicit declaration of function 'cimag'
.\main.c:26: warning: incompatible implicit declaration of built-in function 'cimag'
My question is why it dont find complex.h . I see it in the folder :
C:\Program Files\Cypress\PSoC Creator\2.1\PSoC Creator\import\gnu_cs\arm\4.4.1\arm-none-eabi\include\c++\4.4.1
( May be it's working only with a Cpp file not in C file?)
Thank for your answers and may be a working example in PSoC creator.
I think that I can't use <complex.h> in C program but only in Cpp program, but PSoC creator don't support Cpp program.
Can you confirm or have you a simple example with <complex.h> use ?
Thank for you very good job for the support.