]>
Commit | Line | Data |
---|---|---|
0ecb606c | 1 | /* Copyright (C) 1997, 1998, 1999, 2000, 2006 Free Software Foundation, Inc. |
4cca6b86 UD |
2 | This file is part of the GNU C Library. |
3 | ||
4 | The GNU C Library is free software; you can redistribute it and/or | |
41bdb6e2 AJ |
5 | modify it under the terms of the GNU Lesser General Public |
6 | License as published by the Free Software Foundation; either | |
7 | version 2.1 of the License, or (at your option) any later version. | |
4cca6b86 UD |
8 | |
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 | |
41bdb6e2 | 12 | Lesser General Public License for more details. |
4cca6b86 | 13 | |
41bdb6e2 AJ |
14 | You should have received a copy of the GNU Lesser General Public |
15 | License along with the GNU C Library; if not, write to the Free | |
16 | Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA | |
17 | 02111-1307 USA. */ | |
4cca6b86 UD |
18 | |
19 | /* | |
d1646309 | 20 | * ISO C99: 7.3 Complex arithmetic <complex.h> |
4cca6b86 UD |
21 | */ |
22 | ||
23 | #ifndef _COMPLEX_H | |
24 | #define _COMPLEX_H 1 | |
5107cf1d | 25 | |
993b3242 UD |
26 | #include <features.h> |
27 | ||
63ae7b63 | 28 | /* Get general and ISO C99 specific information. */ |
1792d4db UD |
29 | #include <bits/mathdef.h> |
30 | ||
993b3242 | 31 | __BEGIN_DECLS |
4cca6b86 | 32 | |
63ae7b63 UD |
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 | |
4cca6b86 | 35 | types `float complex' and `double complex'. */ |
b4a555d6 | 36 | #if __GNUC_PREREQ (2, 7) && !__GNUC_PREREQ (2, 97) |
1792d4db | 37 | # define _Complex __complex__ |
4cca6b86 UD |
38 | #endif |
39 | ||
5985c772 | 40 | #define complex _Complex |
4cca6b86 UD |
41 | |
42 | /* Narrowest imaginary unit. This depends on the floating-point | |
43 | evaluation method. | |
44 | XXX This probably has to go into a gcc related file. */ | |
5985c772 | 45 | #define _Complex_I (__extension__ 1.0iF) |
4cca6b86 | 46 | |
fe0ec73e UD |
47 | /* Another more descriptive name is `I'. |
48 | XXX Once we have the imaginary support switch this to _Imaginary_I. */ | |
4cca6b86 | 49 | #undef I |
fe0ec73e | 50 | #define I _Complex_I |
4cca6b86 | 51 | |
5107cf1d UD |
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', | |
4cca6b86 UD |
55 | and can declare the float versions `namef' and `__namef'. */ |
56 | ||
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) \ | |
c1422e5b | 63 | extern type __MATH_PRECNAME(function) args __THROW |
4cca6b86 UD |
64 | |
65 | #define _Mdouble_ double | |
66 | #define __MATH_PRECNAME(name) name | |
5107cf1d | 67 | #include <bits/cmathcalls.h> |
4cca6b86 UD |
68 | #undef _Mdouble_ |
69 | #undef __MATH_PRECNAME | |
70 | ||
71 | /* Now the float versions. */ | |
72 | #ifndef _Mfloat_ | |
1792d4db | 73 | # define _Mfloat_ float |
4cca6b86 UD |
74 | #endif |
75 | #define _Mdouble_ _Mfloat_ | |
76 | #ifdef __STDC__ | |
1792d4db | 77 | # define __MATH_PRECNAME(name) name##f |
4cca6b86 | 78 | #else |
1792d4db | 79 | # define __MATH_PRECNAME(name) name/**/f |
4cca6b86 | 80 | #endif |
5107cf1d | 81 | #include <bits/cmathcalls.h> |
4cca6b86 UD |
82 | #undef _Mdouble_ |
83 | #undef __MATH_PRECNAME | |
84 | ||
85 | /* And the long double versions. It is non-critical to define them | |
63ae7b63 | 86 | here unconditionally since `long double' is required in ISO C99. */ |
0ecb606c JJ |
87 | #if (__STDC__ - 0 || __GNUC__ - 0) \ |
88 | && (!defined __NO_LONG_DOUBLE_MATH || defined __LDBL_COMPAT) | |
89 | # ifdef __LDBL_COMPAT | |
90 | # undef __MATHDECL_1 | |
91 | # define __MATHDECL_1(type, function, args) \ | |
92 | extern type __REDIRECT_NTH(__MATH_PRECNAME(function), args, function) | |
93 | # endif | |
94 | ||
1792d4db UD |
95 | # ifndef _Mlong_double_ |
96 | # define _Mlong_double_ long double | |
97 | # endif | |
98 | # define _Mdouble_ _Mlong_double_ | |
99 | # ifdef __STDC__ | |
100 | # define __MATH_PRECNAME(name) name##l | |
101 | # else | |
102 | # define __MATH_PRECNAME(name) name/**/l | |
103 | # endif | |
104 | # include <bits/cmathcalls.h> | |
4cca6b86 | 105 | #endif |
4cca6b86 UD |
106 | #undef _Mdouble_ |
107 | #undef __MATH_PRECNAME | |
108 | #undef __MATHDECL_1 | |
109 | #undef __MATHDECL | |
110 | #undef __MATHCALL | |
111 | ||
993b3242 UD |
112 | __END_DECLS |
113 | ||
4cca6b86 | 114 | #endif /* complex.h */ |