/****************************************************************************
 *
 * $Source$
 * $Date$
 * $Revision$
 * $State$
 * $Author$
 *
 ***************************************************************************/

#ifndef __COMPLEX_H
#define __COMPLEX_H 1

#ifdef __cplusplus
extern "C" {
#endif

/* We might need to add support for more compilers here.  But once ISO
   C 9X is out hopefully all maintained compilers will provide the data
   types `float complex' and `double complex'.  */
#if (__GNUC__ == 2 && __GNUC_MINOR__ >= 7) || __GNUC__ > 2
# define _Complex __complex__
#endif

/* Narrowest imaginary unit.  This depends on the floating-point
   evaluation method.
   XXX This probably has to go into a gcc related file.  */
#define _Complex_I	(1.0iF)

/* Another more descriptive name is `I'.
   XXX Once we have the imaginary support switch this to _Imaginary_I.  */
#undef I
#define I _Complex_I


/* Optimization aids.  This is not yet implemented in gcc and once it
   is this will probably be available in a gcc header.  */
#define CX_LIMITED_RANGE_ON
#define CX_LIMITED_RANGE_OFF
#define CX_LIMITED_RANGE_DEFAULT

/* Trigonometric functions.  */

/* Arc cosine of Z.  */
_Complex double cacos (double _Complex __z);
_Complex double cacosf (float _Complex __z);
_Complex double cacosl (long double _Complex __z);

/* Arc sine of Z.  */
_Complex double casin (double _Complex __z);
/* Arc tangent of Z.  */
_Complex double catan (double _Complex __z);

/* Cosine of Z.  */
_Complex double ccos (double _Complex __z);
/* Sine of Z.  */
_Complex double csin (double _Complex __z);
/* Tangent of Z.  */
_Complex double ctan (double _Complex __z);


/* Hyperbolic functions.  */

/* Hyperbolic arc cosine of Z.  */
_Complex double cacosh (double _Complex __z);
/* Hyperbolic arc sine of Z.  */
_Complex double casinh (double _Complex __z);
/* Hyperbolic arc tangent of Z.  */
_Complex double catanh (double _Complex __z);

/* Hyperbolic cosine of Z.  */
_Complex double ccosh (double _Complex __z);
/* Hyperbolic sine of Z.  */
_Complex double csinh (double _Complex __z);
/* Hyperbolic tangent of Z.  */
_Complex double ctanh (double _Complex __z);


/* Exponential and logarithmic functions.  */

/* Exponential function of Z.  */
_Complex double cexp (double _Complex __z);

/* Natural logarithm of Z.  */
_Complex double clog (double _Complex __z);

#ifdef __USE_GNU
/* The base 10 logarithm is not defined by the standard but to implement
   the standard C++ library it is handy.  */
_Complex double clog10 (double _Complex __z);
#endif

/* Power functions.  */

/* Return X to the Y power.  */
_Complex double cpow (double _Complex __x, double _Complex __y);

/* Return the square root of Z.  */
_Complex double csqrt (double _Complex __z);


/* Absolute value, conjugates, and projection.  */

/* Absolute value of Z.  */
double cabs (double _Complex __z);

/* Argument value of Z.  */
double carg (double _Complex __z);

/* Complex conjugate of Z.  */
_Complex double conj (double _Complex __z);

/* Projection of Z onto the Riemann sphere.  */
_Complex double cproj (double _Complex __z);


/* Decomposing complex values.  */

/* Imaginary part of Z.  */
double cimag (double _Complex __z);

/* Real part of Z.  */
double creal (double _Complex __z);

#ifdef __cplusplus
}
#endif

#endif
