Anders Misfeldt <[EMAIL PROTECTED]> writes:
> GSL_SET_COMPLEX(&ztest, 3, 4);
> GSL_REAL(ztest);
> printf("%g",ztest);
>
> but I get the following error:
>
> error: request for member `dat' in something not a structure or union
>
> What am I doing wrong?
Several things I think:
1. The macro GSL_REAL extracts/returns the real part of the variable
ztest. It does *not* modify ztest in any way, which it seems you
think.
2. The error message indicates that your variable ztest is not of
type gsl_complex?
3. The ztest variable has (if it is of type gsl_complex, as it should
be) two components, and can not be formattet with printf("%g",);
This little program works:
#include <gsl/gsl_complex.h>
int main (void) {
gsl_complex Z;
GSL_SET_COMPLEX(&Z,3,4);
printf("Re(Z):%g Im(Z):%g \n",GSL_REAL(Z),GSL_IMAG(Z));
}
[As for your "real question" I strongly believe you should proceed
further with pen and paper before you start asking the computer.]
HTH - Joakim
--
Joakim Hove
hove AT ift uib no
Tlf: +47 (55 5)8 27 90
Fax: +47 (55 5)8 94 40
http://www.ift.uib.no/~hove/
_______________________________________________
Help-gsl mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/help-gsl