Back to index

glibc  2.9
complex.h
Go to the documentation of this file.
00001 /* Copyright (C) 1997, 1998, 1999, 2000, 2006 Free Software Foundation, Inc.
00002    This file is part of the GNU C Library.
00003 
00004    The GNU C Library is free software; you can redistribute it and/or
00005    modify it under the terms of the GNU Lesser General Public
00006    License as published by the Free Software Foundation; either
00007    version 2.1 of the License, or (at your option) any later version.
00008 
00009    The GNU C Library is distributed in the hope that it will be useful,
00010    but WITHOUT ANY WARRANTY; without even the implied warranty of
00011    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00012    Lesser General Public License for more details.
00013 
00014    You should have received a copy of the GNU Lesser General Public
00015    License along with the GNU C Library; if not, write to the Free
00016    Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
00017    02111-1307 USA.  */
00018 
00019 /*
00020  *     ISO C99:  7.3 Complex arithmetic   <complex.h>
00021  */
00022 
00023 #ifndef _COMPLEX_H
00024 #define _COMPLEX_H   1
00025 
00026 #include <features.h>
00027 
00028 /* Get general and ISO C99 specific information.  */
00029 #include <bits/mathdef.h>
00030 
00031 __BEGIN_DECLS
00032 
00033 /* We might need to add support for more compilers here.  But since ISO
00034    C99 is out hopefully all maintained compilers will soon provide the data
00035    types `float complex' and `double complex'.  */
00036 #if __GNUC_PREREQ (2, 7) && !__GNUC_PREREQ (2, 97)
00037 # define _Complex __complex__
00038 #endif
00039 
00040 #define complex             _Complex
00041 
00042 /* Narrowest imaginary unit.  This depends on the floating-point
00043    evaluation method.
00044    XXX This probably has to go into a gcc related file.  */
00045 #define _Complex_I   (__extension__ 1.0iF)
00046 
00047 /* Another more descriptive name is `I'.
00048    XXX Once we have the imaginary support switch this to _Imaginary_I.  */
00049 #undef I
00050 #define I _Complex_I
00051 
00052 /* The file <bits/cmathcalls.h> contains the prototypes for all the
00053    actual math functions.  These macros are used for those prototypes,
00054    so we can easily declare each function as both `name' and `__name',
00055    and can declare the float versions `namef' and `__namef'.  */
00056 
00057 #define __MATHCALL(function, args) \
00058   __MATHDECL (_Mdouble_complex_,function, args)
00059 #define __MATHDECL(type, function, args) \
00060   __MATHDECL_1(type, function, args); \
00061   __MATHDECL_1(type, __CONCAT(__,function), args)
00062 #define __MATHDECL_1(type, function, args) \
00063   extern type __MATH_PRECNAME(function) args __THROW
00064 
00065 #define _Mdouble_           double
00066 #define __MATH_PRECNAME(name)      name
00067 #include <bits/cmathcalls.h>
00068 #undef _Mdouble_
00069 #undef __MATH_PRECNAME
00070 
00071 /* Now the float versions.  */
00072 #ifndef _Mfloat_
00073 # define _Mfloat_           float
00074 #endif
00075 #define _Mdouble_           _Mfloat_
00076 #ifdef __STDC__
00077 # define __MATH_PRECNAME(name)     name##f
00078 #else
00079 # define __MATH_PRECNAME(name)     namef
00080 #endif
00081 #include <bits/cmathcalls.h>
00082 #undef _Mdouble_
00083 #undef __MATH_PRECNAME
00084 
00085 /* And the long double versions.  It is non-critical to define them
00086    here unconditionally since `long double' is required in ISO C99.  */
00087 #if (__STDC__ - 0 || __GNUC__ - 0) \
00088     && (!defined __NO_LONG_DOUBLE_MATH || defined __LDBL_COMPAT)
00089 # ifdef __LDBL_COMPAT
00090 #  undef __MATHDECL_1
00091 #  define __MATHDECL_1(type, function, args) \
00092   extern type __REDIRECT_NTH(__MATH_PRECNAME(function), args, function)
00093 # endif
00094 
00095 # ifndef _Mlong_double_
00096 #  define _Mlong_double_    long double
00097 # endif
00098 # define _Mdouble_          _Mlong_double_
00099 # ifdef __STDC__
00100 #  define __MATH_PRECNAME(name)    name##l
00101 # else
00102 #  define __MATH_PRECNAME(name)    namel
00103 # endif
00104 # include <bits/cmathcalls.h>
00105 #endif
00106 #undef _Mdouble_
00107 #undef __MATH_PRECNAME
00108 #undef __MATHDECL_1
00109 #undef __MATHDECL
00110 #undef __MATHCALL
00111 
00112 __END_DECLS
00113 
00114 #endif /* complex.h */