1178172Simp/* Prototype declarations for complex math functions;
2178172Simp   helper file for <complex.h>.
3178172Simp   Copyright (C) 1997, 1998, 2001 Free Software Foundation, Inc.
4178172Simp   This file is part of the GNU C Library.
5178172Simp
6178172Simp   The GNU C Library is free software; you can redistribute it and/or
7178172Simp   modify it under the terms of the GNU Lesser General Public
8178172Simp   License as published by the Free Software Foundation; either
9178172Simp   version 2.1 of the License, or (at your option) any later version.
10178172Simp
11178172Simp   The GNU C Library is distributed in the hope that it will be useful,
12178172Simp   but WITHOUT ANY WARRANTY; without even the implied warranty of
13178172Simp   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14178172Simp   Lesser General Public License for more details.
15178172Simp
16178172Simp   You should have received a copy of the GNU Lesser General Public
17178172Simp   License along with the GNU C Library; if not, write to the Free
18178172Simp   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
19178172Simp   02111-1307 USA.  */
20178172Simp
21178172Simp/* NOTE: Because of the special way this file is used by <complex.h>, this
22178172Simp   file must NOT be protected from multiple inclusion as header files
23178172Simp   usually are.
24178172Simp
25178172Simp   This file provides prototype declarations for the math functions.
26178172Simp   Most functions are declared using the macro:
27178172Simp
28178172Simp   __MATHCALL (NAME, (ARGS...));
29178172Simp
30178172Simp   This means there is a function `NAME' returning `double' and a function
31178172Simp   `NAMEf' returning `float'.  Each place `_Mdouble_' appears in the
32178172Simp   prototype, that is actually `double' in the prototype for `NAME' and
33178172Simp   `float' in the prototype for `NAMEf'.  Reentrant variant functions are
34178172Simp   called `NAME_r' and `NAMEf_r'.
35178172Simp
36178172Simp   Functions returning other types like `int' are declared using the macro:
37178172Simp
38178172Simp   __MATHDECL (TYPE, NAME, (ARGS...));
39178172Simp
40178172Simp   This is just like __MATHCALL but for a function returning `TYPE'
41178172Simp   instead of `_Mdouble_'.  In all of these cases, there is still
42178172Simp   both a `NAME' and a `NAMEf' that takes `float' arguments.  */
43235941Sbz
44178172Simp#ifndef _COMPLEX_H
45178172Simp#error "Never use <bits/cmathcalls.h> directly; include <complex.h> instead."
46178172Simp#endif
47178172Simp
48178172Simp#define _Mdouble_complex_ _Mdouble_ _Complex
49178172Simp
50178172Simp
51178172Simp/* Trigonometric functions.  */
52178172Simp
53178172Simp/* Arc cosine of Z.  */
54178172Simp__MATHCALL (cacos, (_Mdouble_complex_ __z));
55178172Simp/* Arc sine of Z.  */
56178172Simp__MATHCALL (casin, (_Mdouble_complex_ __z));
57178172Simp/* Arc tangent of Z.  */
58178172Simp__MATHCALL (catan, (_Mdouble_complex_ __z));
59178172Simp
60178172Simp/* Cosine of Z.  */
61178172Simp__MATHCALL (ccos, (_Mdouble_complex_ __z));
62178172Simp/* Sine of Z.  */
63178172Simp__MATHCALL (csin, (_Mdouble_complex_ __z));
64178172Simp/* Tangent of Z.  */
65178172Simp__MATHCALL (ctan, (_Mdouble_complex_ __z));
66178172Simp
67178172Simp
68178172Simp/* Hyperbolic functions.  */
69178172Simp
70235941Sbz/* Hyperbolic arc cosine of Z.  */
71178172Simp__MATHCALL (cacosh, (_Mdouble_complex_ __z));
72178172Simp/* Hyperbolic arc sine of Z.  */
73235941Sbz__MATHCALL (casinh, (_Mdouble_complex_ __z));
74178172Simp/* Hyperbolic arc tangent of Z.  */
75235941Sbz__MATHCALL (catanh, (_Mdouble_complex_ __z));
76178172Simp
77178172Simp/* Hyperbolic cosine of Z.  */
78178172Simp__MATHCALL (ccosh, (_Mdouble_complex_ __z));
79178172Simp/* Hyperbolic sine of Z.  */
80178172Simp__MATHCALL (csinh, (_Mdouble_complex_ __z));
81178172Simp/* Hyperbolic tangent of Z.  */
82__MATHCALL (ctanh, (_Mdouble_complex_ __z));
83
84
85/* Exponential and logarithmic functions.  */
86
87/* Exponential function of Z.  */
88__MATHCALL (cexp, (_Mdouble_complex_ __z));
89
90/* Natural logarithm of Z.  */
91__MATHCALL (clog, (_Mdouble_complex_ __z));
92
93#ifdef __USE_GNU
94/* The base 10 logarithm is not defined by the standard but to implement
95   the standard C++ library it is handy.  */
96__MATHCALL (clog10, (_Mdouble_complex_ __z));
97#endif
98
99/* Power functions.  */
100
101/* Return X to the Y power.  */
102__MATHCALL (cpow, (_Mdouble_complex_ __x, _Mdouble_complex_ __y));
103
104/* Return the square root of Z.  */
105__MATHCALL (csqrt, (_Mdouble_complex_ __z));
106
107
108/* Absolute value, conjugates, and projection.  */
109
110/* Absolute value of Z.  */
111__MATHDECL (_Mdouble_,cabs, (_Mdouble_complex_ __z));
112
113/* Argument value of Z.  */
114__MATHDECL (_Mdouble_,carg, (_Mdouble_complex_ __z));
115
116/* Complex conjugate of Z.  */
117__MATHCALL (conj, (_Mdouble_complex_ __z));
118
119/* Projection of Z onto the Riemann sphere.  */
120__MATHCALL (cproj, (_Mdouble_complex_ __z));
121
122
123/* Decomposing complex values.  */
124
125/* Imaginary part of Z.  */
126__MATHDECL (_Mdouble_,cimag, (_Mdouble_complex_ __z));
127
128/* Real part of Z.  */
129__MATHDECL (_Mdouble_,creal, (_Mdouble_complex_ __z));
130
131
132/* Now some optimized versions.  GCC has handy notations for these
133   functions.  Recent GCC handles these as builtin functions so does
134   not need inlines.  */
135#if defined __GNUC__ && !__GNUC_PREREQ (2, 97) && defined __OPTIMIZE__
136
137/* Imaginary part of Z.  */
138extern __inline _Mdouble_
139__MATH_PRECNAME(cimag) (_Mdouble_complex_ __z) __THROW
140{
141  return __imag__ __z;
142}
143
144/* Real part of Z.  */
145extern __inline _Mdouble_
146__MATH_PRECNAME(creal) (_Mdouble_complex_ __z) __THROW
147{
148  return __real__ __z;
149}
150
151/* Complex conjugate of Z.  */
152extern __inline _Mdouble_complex_
153__MATH_PRECNAME(conj) (_Mdouble_complex_ __z) __THROW
154{
155  return __extension__ ~__z;
156}
157
158#endif
159