--
jacob navia
jacob at jacob point remcomp point fr
logiciels/informatique
http://www.cs.virginia.edu/~lcc-win32
> What's new in the new version of lcc-win32
> ------------------------------------------
> Mar 24:
> When you give the -ansic option, the file complex.h wasn't compiling
> correctly. Fixed.
> The following standard code:
> int operator = (42);
> was mistakenly confused with an operator declaration. Fixed.
> Incrementing a 64 bit int array would not work correctly. Fixed.
> Functions Fresnel, FresnelS and FresnelC were added to the special
> functions package.
You also seem to have fixed the missing definition of _Complex_I and
the types of creal and cimag.
--
Ben.
Yes, and now, (as a side effect) you can't use
creal(z) = 5;
as you could till yesterday. This is obviously not a standard syntax,
but it was really handy.
The "unofficial" syntax to assign to one part of the
complex number is:
z.re = 5; // assigns to the real part
z.im = 5; // Assigns to the imaginary part
The official syntax is
z = 5 + cimag(z); // Assigns 5 to real part
z = creal(z) + 5*I; // Assigns to the imaginary part.
> Ben Bacarisse wrote:
<snip>
>> You also seem to have fixed the missing definition of _Complex_I and
>> the types of creal and cimag.
>>
>
> Yes, and now, (as a side effect) you can't use
> creal(z) = 5;
You could always make casts produce modifiable lvalues -- as an
extension.
In the long-run, don't you want to have complex numbers
whose components are the smallest allowable size? I.e. don't you want
float _Complex to use two floats?
> The official syntax is
>
> z = 5 + cimag(z); // Assigns 5 to real part
> z = creal(z) + 5*I; // Assigns to the imaginary part.
I remember doing quote a bit of scientific programming a long time
ago, and modifying the parts of complex number was not a common thing
to do. I may be wrong about that, but I would not worry about it.
--
Ben.
You are in principle correct.
In practic, I see a LOT of code that uses the real and
imaginary parts separate because there wasn't any complex support
until C99. For instance all the code translated from fortran
subroutines in netlib handles the complex parts separately.