DOC HOME SITE MAP MAN PAGES GNU INFO SEARCH PRINT BOOK
 

complex(C++)


complex -- introduction to C++ complex mathematics library

Synopsis

   #include <complex.h>
   class	complex;

Description

This section describes functions and operators found in the C++ Complex Mathematics Library, libcomplex.a. These functions are not automatically loaded by the C++ compiler, CC(CP); you must specify -lcomplex -lm on the CC command line to link in these functions and the underlying C math library. Declarations for these functions may be found in the #include file <complex.h>.

The Complex Mathematics library implements the data type of complex numbers as a class, complex. It overloads the standard input, output, arithmetic, assignment, and comparison operators, discussed in the manual pages for cplxops(C++). It also overloads the standard exponential, logarithm, power, and square root functions, discussed in cplxexp(C++), and the trigonometric functions of sine, cosine, hyperbolic sine, and hyperbolic cosine, discussed in cplxtrig(C++), for the class complex. Routines for converting between Cartesian and polar coordinate systems are discussed in cartpol(C++). Error handling is described in complex_error(C++). The Complex Mathematics library also provides overloaded I/O operators of the form:

   istream& operator>>(istream&, complex&) throw();
   ostream& operator<<(ostream&, complex) throw();
The expected forms for complex input are:
   f
   ( f )
   ( f , f )
where f is a floating point literal, while the form for output is:
   ( f, f)

Files

INCDIR/CC/complex.h
LIBDIR/libcomplex.a

References

cartpol(C++), complex_error(C++), cplxops(C++), cplxexp(C++), cplxtrig(C++)

Diagnostics

Functions in the Complex Mathematics Library (3C++) may return the conventional values (0, 0), (0, ±HUGE), (±HUGE, 0), or (±HUGE, ±HUGE), when the function is undefined for the given arguments or when the value is not representable. (HUGE is the largest-magnitude single-precision floating-point number and is defined in the file <math.h>. The header file <math.h> is included in the file <complex.h>.) In these cases, the external variable errno [see intro(S)] is set to the value EDOM or ERANGE.
© 2005 The SCO Group, Inc. All rights reserved.
SCO OpenServer Release 6.0.0 - 01 June 2005