Back to index

glibc  2.9
cmathcalls.h
Go to the documentation of this file.
00001 /* Prototype declarations for complex math functions;
00002    helper file for <complex.h>.
00003    Copyright (C) 1997, 1998, 2001, 2007 Free Software Foundation, Inc.
00004    This file is part of the GNU C Library.
00005 
00006    The GNU C Library is free software; you can redistribute it and/or
00007    modify it under the terms of the GNU Lesser General Public
00008    License as published by the Free Software Foundation; either
00009    version 2.1 of the License, or (at your option) any later version.
00010 
00011    The GNU C Library is distributed in the hope that it will be useful,
00012    but WITHOUT ANY WARRANTY; without even the implied warranty of
00013    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00014    Lesser General Public License for more details.
00015 
00016    You should have received a copy of the GNU Lesser General Public
00017    License along with the GNU C Library; if not, write to the Free
00018    Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
00019    02111-1307 USA.  */
00020 
00021 /* NOTE: Because of the special way this file is used by <complex.h>, this
00022    file must NOT be protected from multiple inclusion as header files
00023    usually are.
00024 
00025    This file provides prototype declarations for the math functions.
00026    Most functions are declared using the macro:
00027 
00028    __MATHCALL (NAME, (ARGS...));
00029 
00030    This means there is a function `NAME' returning `double' and a function
00031    `NAMEf' returning `float'.  Each place `_Mdouble_' appears in the
00032    prototype, that is actually `double' in the prototype for `NAME' and
00033    `float' in the prototype for `NAMEf'.  Reentrant variant functions are
00034    called `NAME_r' and `NAMEf_r'.
00035 
00036    Functions returning other types like `int' are declared using the macro:
00037 
00038    __MATHDECL (TYPE, NAME, (ARGS...));
00039 
00040    This is just like __MATHCALL but for a function returning `TYPE'
00041    instead of `_Mdouble_'.  In all of these cases, there is still
00042    both a `NAME' and a `NAMEf' that takes `float' arguments.  */
00043 
00044 #ifndef _COMPLEX_H
00045 #error "Never use <bits/cmathcalls.h> directly; include <complex.h> instead."
00046 #endif
00047 
00048 #define _Mdouble_complex_ _Mdouble_ _Complex
00049 
00050 
00051 /* Trigonometric functions.  */
00052 
00053 /* Arc cosine of Z.  */
00054 __MATHCALL (cacos, (_Mdouble_complex_ __z));
00055 /* Arc sine of Z.  */
00056 __MATHCALL (casin, (_Mdouble_complex_ __z));
00057 /* Arc tangent of Z.  */
00058 __MATHCALL (catan, (_Mdouble_complex_ __z));
00059 
00060 /* Cosine of Z.  */
00061 __MATHCALL (ccos, (_Mdouble_complex_ __z));
00062 /* Sine of Z.  */
00063 __MATHCALL (csin, (_Mdouble_complex_ __z));
00064 /* Tangent of Z.  */
00065 __MATHCALL (ctan, (_Mdouble_complex_ __z));
00066 
00067 
00068 /* Hyperbolic functions.  */
00069 
00070 /* Hyperbolic arc cosine of Z.  */
00071 __MATHCALL (cacosh, (_Mdouble_complex_ __z));
00072 /* Hyperbolic arc sine of Z.  */
00073 __MATHCALL (casinh, (_Mdouble_complex_ __z));
00074 /* Hyperbolic arc tangent of Z.  */
00075 __MATHCALL (catanh, (_Mdouble_complex_ __z));
00076 
00077 /* Hyperbolic cosine of Z.  */
00078 __MATHCALL (ccosh, (_Mdouble_complex_ __z));
00079 /* Hyperbolic sine of Z.  */
00080 __MATHCALL (csinh, (_Mdouble_complex_ __z));
00081 /* Hyperbolic tangent of Z.  */
00082 __MATHCALL (ctanh, (_Mdouble_complex_ __z));
00083 
00084 
00085 /* Exponential and logarithmic functions.  */
00086 
00087 /* Exponential function of Z.  */
00088 __MATHCALL (cexp, (_Mdouble_complex_ __z));
00089 
00090 /* Natural logarithm of Z.  */
00091 __MATHCALL (clog, (_Mdouble_complex_ __z));
00092 
00093 #ifdef __USE_GNU
00094 /* The base 10 logarithm is not defined by the standard but to implement
00095    the standard C++ library it is handy.  */
00096 __MATHCALL (clog10, (_Mdouble_complex_ __z));
00097 #endif
00098 
00099 /* Power functions.  */
00100 
00101 /* Return X to the Y power.  */
00102 __MATHCALL (cpow, (_Mdouble_complex_ __x, _Mdouble_complex_ __y));
00103 
00104 /* Return the square root of Z.  */
00105 __MATHCALL (csqrt, (_Mdouble_complex_ __z));
00106 
00107 
00108 /* Absolute value, conjugates, and projection.  */
00109 
00110 /* Absolute value of Z.  */
00111 __MATHDECL (_Mdouble_,cabs, (_Mdouble_complex_ __z));
00112 
00113 /* Argument value of Z.  */
00114 __MATHDECL (_Mdouble_,carg, (_Mdouble_complex_ __z));
00115 
00116 /* Complex conjugate of Z.  */
00117 __MATHCALL (conj, (_Mdouble_complex_ __z));
00118 
00119 /* Projection of Z onto the Riemann sphere.  */
00120 __MATHCALL (cproj, (_Mdouble_complex_ __z));
00121 
00122 
00123 /* Decomposing complex values.  */
00124 
00125 /* Imaginary part of Z.  */
00126 __MATHDECL (_Mdouble_,cimag, (_Mdouble_complex_ __z));
00127 
00128 /* Real part of Z.  */
00129 __MATHDECL (_Mdouble_,creal, (_Mdouble_complex_ __z));
00130 
00131 
00132 /* Now some optimized versions.  GCC has handy notations for these
00133    functions.  Recent GCC handles these as builtin functions so does
00134    not need inlines.  */
00135 #if defined __GNUC__ && !__GNUC_PREREQ (2, 97) && defined __OPTIMIZE__ \
00136     && defined __extern_inline
00137 
00138 /* Imaginary part of Z.  */
00139 __extern_inline _Mdouble_
00140 __MATH_PRECNAME(cimag) (_Mdouble_complex_ __z) __THROW
00141 {
00142   return __imag__ __z;
00143 }
00144 
00145 /* Real part of Z.  */
00146 __extern_inline _Mdouble_
00147 __MATH_PRECNAME(creal) (_Mdouble_complex_ __z) __THROW
00148 {
00149   return __real__ __z;
00150 }
00151 
00152 /* Complex conjugate of Z.  */
00153 __extern_inline _Mdouble_complex_
00154 __MATH_PRECNAME(conj) (_Mdouble_complex_ __z) __THROW
00155 {
00156   return __extension__ ~__z;
00157 }
00158 
00159 #endif