help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Octave C++ libs ported to Borland C++ for OS/2


From: Jim Van Zandt
Subject: Re: Octave C++ libs ported to Borland C++ for OS/2
Date: Thu, 09 Nov 1995 20:01:00 -0500

Wonkoo Kim writes:
>It's nice to know.  Though this is not a C forum:
>Can I convert a complex data to its complex conjugate with a builtin
>keyword?  Where can I find more about complex data type?

This is the first I've seen of them too.

I grabbed this from the .info file on gcc:

Complex Numbers
===============

   GNU C supports complex data types.  You can declare both complex
integer types and complex floating types, using the keyword
`__complex__'.

   For example, `__complex__ double x;' declares `x' as a variable
whose real part and imaginary part are both of type `double'.
`__complex__ short int y;' declares `y' to have real and imaginary
parts of type `short int'; this is not likely to be useful, but it
shows that the set of complex types is complete.

   To write a constant with a complex data type, use the suffix `i' or
`j' (either one; they are equivalent).  For example, `2.5fi' has type
`__complex__ float' and `3i' has type `__complex__ int'.  Such a
constant always has a pure imaginary value, but you can form any
complex value you like by adding one to a real constant.

   To extract the real part of a complex-valued expression EXP, write
`__real__ EXP'.  Likewise, use `__imag__' to extract the imaginary
part.

   The operator `~' performs complex conjugation when used on a value
with a complex type.

   GNU CC can allocate complex automatic variables in a noncontiguous
fashion; it's even possible for the real part to be in a register
while the imaginary part is on the stack (or vice-versa).  None of the
supported debugging info formats has a way to represent noncontiguous
allocation like this, so GNU CC describes a noncontiguous complex
variable as if it were two separate variables of noncomplex type.  If
the variable's actual name is `foo', the two fictitious variables are
named `foo$real' and `foo$imag'.  You can examine and set these two
fictitious variables with your debugger.

   A future version of GDB will know how to recognize such pairs and
treat them as a single variable with a complex type.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]