]>
Commit | Line | Data |
---|---|---|
1792d4db | 1 | /* Copyright (C) 1997, 1998 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 | |
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. | |
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 | |
12 | Library General Public License for more details. | |
13 | ||
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. */ | |
18 | ||
19 | /* | |
20 | * ISO C 9X: 7.8 Complex arithmetic <complex.h> | |
21 | */ | |
22 | ||
23 | #ifndef _COMPLEX_H | |
24 | #define _COMPLEX_H 1 | |
5107cf1d | 25 | |
993b3242 UD |
26 | #include <features.h> |
27 | ||
1792d4db UD |
28 | /* Get general and ISO C 9X specific information. */ |
29 | #include <bits/mathdef.h> | |
30 | ||
993b3242 | 31 | __BEGIN_DECLS |
4cca6b86 UD |
32 | |
33 | /* We might need to add support for more compilers here. But once ISO | |
34 | C 9X is out hopefully all maintained compilers will provide the data | |
35 | types `float complex' and `double complex'. */ | |
4360eafd | 36 | #if __GNUC_PREREQ (2, 7) |
1792d4db | 37 | # define _Complex __complex__ |
4cca6b86 UD |
38 | #endif |
39 | ||
40 | ||
41 | /* Narrowest imaginary unit. This depends on the floating-point | |
42 | evaluation method. | |
43 | XXX This probably has to go into a gcc related file. */ | |
cc3fa755 | 44 | #define _Complex_I (1.0iF) |
4cca6b86 | 45 | |
fe0ec73e UD |
46 | /* Another more descriptive name is `I'. |
47 | XXX Once we have the imaginary support switch this to _Imaginary_I. */ | |
4cca6b86 | 48 | #undef I |
fe0ec73e | 49 | #define I _Complex_I |
4cca6b86 UD |
50 | |
51 | ||
993b3242 | 52 | /* Optimization aids. This is not yet implemented in gcc and once it |
4cca6b86 UD |
53 | is this will probably be available in a gcc header. */ |
54 | #define CX_LIMITED_RANGE_ON | |
55 | #define CX_LIMITED_RANGE_OFF | |
56 | #define CX_LIMITED_RANGE_DEFAULT | |
57 | ||
58 | ||
5107cf1d UD |
59 | /* The file <bits/cmathcalls.h> contains the prototypes for all the |
60 | actual math functions. These macros are used for those prototypes, | |
61 | so we can easily declare each function as both `name' and `__name', | |
4cca6b86 UD |
62 | and can declare the float versions `namef' and `__namef'. */ |
63 | ||
64 | #define __MATHCALL(function, args) \ | |
65 | __MATHDECL (_Mdouble_complex_,function, args) | |
66 | #define __MATHDECL(type, function, args) \ | |
67 | __MATHDECL_1(type, function, args); \ | |
68 | __MATHDECL_1(type, __CONCAT(__,function), args) | |
69 | #define __MATHDECL_1(type, function, args) \ | |
70 | extern type __MATH_PRECNAME(function) args | |
71 | ||
72 | #define _Mdouble_ double | |
73 | #define __MATH_PRECNAME(name) name | |
5107cf1d | 74 | #include <bits/cmathcalls.h> |
4cca6b86 UD |
75 | #undef _Mdouble_ |
76 | #undef __MATH_PRECNAME | |
77 | ||
78 | /* Now the float versions. */ | |
79 | #ifndef _Mfloat_ | |
1792d4db | 80 | # define _Mfloat_ float |
4cca6b86 UD |
81 | #endif |
82 | #define _Mdouble_ _Mfloat_ | |
83 | #ifdef __STDC__ | |
1792d4db | 84 | # define __MATH_PRECNAME(name) name##f |
4cca6b86 | 85 | #else |
1792d4db | 86 | # define __MATH_PRECNAME(name) name/**/f |
4cca6b86 | 87 | #endif |
5107cf1d | 88 | #include <bits/cmathcalls.h> |
4cca6b86 UD |
89 | #undef _Mdouble_ |
90 | #undef __MATH_PRECNAME | |
91 | ||
92 | /* And the long double versions. It is non-critical to define them | |
93 | here unconditionally since `long double' is required in ISO C 9X. */ | |
1792d4db UD |
94 | #if __STDC__ - 0 || __GNUC__ - 0 && !defined __NO_LONG_DOUBLE_MATH |
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 */ |