
complex numbers - most common ways?
For complex numbers, you might want to consider C++ or even
fortran90. Both
of those put C to shame in that category. Here is the complex header
documentation for complex templates in C++:
http://www.dinkumware.com/htm_cpl/complex.html
But, as for normal usage, you will find the struct is more common. The
Cephes library at http://www.netlib.org has a bunch of complex math routines
and structures already worked out for you. You might give that a look-see
if you want to do it in C.
--
Hypertext C-FAQ: http://www.eskimo.com/~scs/C-faq/top.html
C-FAQ ftp: ftp://rtfm.mit.edu, C-FAQ Book: ISBN 0-201-84519-9
Try "C Programming: A Modern Approach" ISBN 0-393-96945-2
Want Software? Algorithms? Pubs? http://www.infoseek.com
Quote:
>I am developing a set of functions to do some data manipulation of values
>and I personally have some need to do this with complex numbers. So I
>will be including them. But I do not yet have an established means of
>how I use complex numbers. What I would like to know is what is the
>most common methods, and what would be most convenient to other programmers
>of C programs that do or may involve complex numbers.
>The function I am writing builds binary trees to collect data items.
>If you were needing to collect and retrieve by value complex numbers,
>possibly associated with other data, would you tend to use structs to
>make the complex numbers, or just separate variables? Would calling
>a function to do a lookup based on a complex number be easier by one
>or the other of these methods (or by some way I had not considered)?
>1. tree_find_complex( root , real , imaginary );
>2. complex_struct.real = real;
> complex_struct.imaginary = imaginary;
> tree_find_complex( root , complex_struct );
>I have the tendency to go with the struct. But I just want to make sure
>that I'm not overlooking some established standards.
>--
> -- *-----------------------------* Phil Howard KA9WGN
* --
> -- | Inturnet, Inc. | Director of Internet Services | --
> -- | Business Internet Solutions | eng at intur.net | --
> -- *-----------------------------* philh at intur.net * --