1 /* Copyright (C) 1997, 1998, 1999 Free Software Foundation, Inc.
2 This file is part of the GNU C Library.
4 The GNU C Library is free software; you can redistribute it and/or
5 modify it under the terms of the GNU Library General Public License as
6 published by the Free Software Foundation; either version 2 of the
7 License, or (at your option) any later version.
9 The GNU C Library is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 Library General Public License for more details.
14 You should have received a copy of the GNU Library General Public
15 License along with the GNU C Library; see the file COPYING.LIB. If not,
16 write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
17 Boston, MA 02111-1307, USA. */
20 * ISO C99: 7.3 Complex arithmetic <complex.h>
28 /* Get general and ISO C99 specific information. */
29 #include <bits/mathdef.h>
33 /* We might need to add support for more compilers here. But since ISO
34 C99 is out hopefully all maintained compilers will soon provide the data
35 types `float complex' and `double complex'. */
36 #if __GNUC_PREREQ (2, 7) && !__GNUC_PREREQ (3, 0)
37 # define _Complex __complex__
40 #define complex _Complex
42 /* Narrowest imaginary unit. This depends on the floating-point
44 XXX This probably has to go into a gcc related file. */
45 #define _Complex_I (__extension__ 1.0iF)
47 /* Another more descriptive name is `I'.
48 XXX Once we have the imaginary support switch this to _Imaginary_I. */
52 /* The file <bits/cmathcalls.h> contains the prototypes for all the
53 actual math functions. These macros are used for those prototypes,
54 so we can easily declare each function as both `name' and `__name',
55 and can declare the float versions `namef' and `__namef'. */
57 #define __MATHCALL(function, args) \
58 __MATHDECL (_Mdouble_complex_,function, args)
59 #define __MATHDECL(type, function, args) \
60 __MATHDECL_1(type, function, args); \
61 __MATHDECL_1(type, __CONCAT(__,function), args)
62 #define __MATHDECL_1(type, function, args) \
63 extern type __MATH_PRECNAME(function) args __THROW
65 #define _Mdouble_ double
66 #define __MATH_PRECNAME(name) name
67 #include <bits/cmathcalls.h>
69 #undef __MATH_PRECNAME
71 /* Now the float versions. */
73 # define _Mfloat_ float
75 #define _Mdouble_ _Mfloat_
77 # define __MATH_PRECNAME(name) name##f
79 # define __MATH_PRECNAME(name) name/**/f
81 #include <bits/cmathcalls.h>
83 #undef __MATH_PRECNAME
85 /* And the long double versions. It is non-critical to define them
86 here unconditionally since `long double' is required in ISO C99. */
87 #if __STDC__ - 0 || __GNUC__ - 0 && !defined __NO_LONG_DOUBLE_MATH
88 # ifndef _Mlong_double_
89 # define _Mlong_double_ long double
91 # define _Mdouble_ _Mlong_double_
93 # define __MATH_PRECNAME(name) name##l
95 # define __MATH_PRECNAME(name) name/**/l
97 # include <bits/cmathcalls.h>
100 #undef __MATH_PRECNAME
107 #endif /* complex.h */