Path: utzoo!utgpu!news-server.csri.toronto.edu!bonnie.concordia.ca!uunet!taumet!steve From: steve@taumet.com (Stephen Clamage) Newsgroups: comp.lang.c++ Subject: Re: c++ and complex numbers Keywords: c-language, complex numbers, complex functions Message-ID: <735@taumet.com> Date: 20 May 91 16:35:43 GMT References: <480@al.wfw.wtb.tue.nl> Organization: Taumetric Corporation, San Diego Lines: 24 reuder@lso.win.tue.nl (Peter Reuderink) writes: >I was informed that originally in c-language it was not possible >to use complex numbers in the way it's done in FORTRAN as well. >However, can someone tell me if it can be done in c++? One of the strengths of C++ is that user-defined data types have all the same properties and privileges as predefined data types. Many implementations of C++ come with a header and runtime library supporting complex numbers. Many C++ texts use complex numbers for simple examples of programming in C++. You can get the notational convenience and efficiency of built-in complex numbers, even though they are not built into C++. For example, you can make declarations like Complex a; Complex i(0, 1); // i == sqrt(-1) double d; int j; and write expressions like a = ((d + j) * i) / Complex(3.5, 1.234); -- Steve Clamage, TauMetric Corp, steve@taumet.com