Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Programming > Compilers LCC > Complex number ...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 1 of 6 Topic 1029 of 1062
Post > Topic >>

Complex number sup****t

by Ben Bacarisse <ben.usenet@[EMAIL PROTECTED] > Mar 23, 2008 at 01:55 AM

As discussed on comp.lang.c, I am posting about complex number sup****t
in lcc-win32.  I was going to post about a number of issues, but I
think, now, that are mostly related.

I suspect that the problem is either than I simply don't know what I
am doing, or lcc-win32 is missing some basic elements of C99 complex
arithmetic because the first problem is simply this:

-------- 1.c ---------
int main(void)
{
     double _Complex x = 1.0;
     return 0;
}
--- lcc-win32 says ---
Error 1.c: 3 operands of = have illegal types 'struct long double
_Complex' and 'double'
----------------------

This is with or without the -ansic flag.  Adding #include <complex.h>
and the problem is goes away, *unless* -ansic is specified:

-------- 2.c ---------
#include <complex.h>

int main(void)
{
     double _Complex x = 1.0;
     return 0;
}
--- lcc -ansic says ---
Error 2.c: 5  operands of = have illegal types 'struct long double
_Complex' and 'double'
-----------------------

These are so basic that I suspect I am missing something, but I can't
see what.  No programs with complex numbers seem to work when I use
the -ansic flag, but that flag is needed or I can't compile:

-------- 7.c ---------
#include <stdio.h>
#include <complex.h>

int operator = (42);

int main(void)
{
     double _Complex x = 1+2*I;
     printf("%d\n", operator);
     return 0;
}
--- lcc-win32 says ---
Error 7.c: 4  syntax error; found `42' expecting ')'
Error 7.c: 4  skipping `42'
Error 7.c: 4  incorrect number of arguments to operator asgn
Error 7.c: 9  undeclared identifier 'operator'
Warning 7.c: complex-7.c: 9  possible usage of operator before definition
----------------------

A couple of small points (and neither depends on the -ansic flag) are:
_Complex_I seems not to be defined in complex.h and the types of creal
and cimag seem to be wrong:

-------- 5.c ---------
#include <stdio.h>
#include <complex.h>

int main(void)
{
     double _Complex x = _Complex_I;
     printf("%g+%gI\n", creal(x), cimag(x));
     return 0;
}
--- lcc-win32 says ---
Error 5.c: 6  undeclared identifier '_Complex_I'
Warning 5.c: 7  printf argument mismatch for format g. Expected double
got long double
Warning 5.c: 7  printf argument mismatch for format g. Expected double
got long double
Warning 5.c: 6  possible usage of _Complex_I before definition
----------------------

-- 
Ben.
 




 6 Posts in Topic:
Complex number support
Ben Bacarisse <ben.use  2008-03-23 01:55:43 
Re: Complex number support
jacob navia <jacob@[EM  2008-03-23 10:51:15 
Re: Complex number support
Ben Bacarisse <ben.use  2008-03-23 12:48:12 
Re: Complex number support
jacob navia <jacob@[EM  2008-03-23 14:01:14 
Re: Complex number support
Ben Bacarisse <ben.use  2008-03-23 14:36:23 
Re: Complex number support
Keith Thompson <kst-u@  2008-04-02 21:13:49 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Fri Jul 25 2:57:36 CDT 2008.