i386: Replace assembly versions of e_log2f with generic e_log2f.c
[glibc.git] / math / complex.h
blob1ae4ec24093d687ca6cce2bc70edbf50595dc684
1 /* Copyright (C) 1997-2017 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 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.
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 Lesser General Public License for more details.
14 You should have received a copy of the GNU Lesser General Public
15 License along with the GNU C Library; if not, see
16 <http://www.gnu.org/licenses/>. */
19 * ISO C99: 7.3 Complex arithmetic <complex.h>
22 #ifndef _COMPLEX_H
23 #define _COMPLEX_H 1
25 #define __GLIBC_INTERNAL_STARTING_HEADER_IMPLEMENTATION
26 #include <bits/libc-header-start.h>
28 /* Get general and ISO C99 specific information. */
29 #include <bits/mathdef.h>
31 /* Gather machine-dependent _FloatN type support. */
32 #include <bits/floatn.h>
34 __BEGIN_DECLS
36 /* We might need to add support for more compilers here. But since ISO
37 C99 is out hopefully all maintained compilers will soon provide the data
38 types `float complex' and `double complex'. */
39 #if __GNUC_PREREQ (2, 7) && !__GNUC_PREREQ (2, 97)
40 # define _Complex __complex__
41 #endif
43 #define complex _Complex
45 /* Narrowest imaginary unit. This depends on the floating-point
46 evaluation method.
47 XXX This probably has to go into a gcc related file. */
48 #define _Complex_I (__extension__ 1.0iF)
50 /* Another more descriptive name is `I'.
51 XXX Once we have the imaginary support switch this to _Imaginary_I. */
52 #undef I
53 #define I _Complex_I
55 #if defined __USE_ISOC11 && __GNUC_PREREQ (4, 7)
56 /* Macros to expand into expression of specified complex type. */
57 # define CMPLX(x, y) __builtin_complex ((double) (x), (double) (y))
58 # define CMPLXF(x, y) __builtin_complex ((float) (x), (float) (y))
59 # define CMPLXL(x, y) __builtin_complex ((long double) (x), (long double) (y))
60 #endif
62 #if __HAVE_FLOAT128 && __GLIBC_USE (IEC_60559_TYPES_EXT)
63 # define CMPLXF128(x, y) __builtin_complex ((_Float128) (x), (_Float128) (y))
64 #endif
66 /* The file <bits/cmathcalls.h> contains the prototypes for all the
67 actual math functions. These macros are used for those prototypes,
68 so we can easily declare each function as both `name' and `__name',
69 and can declare the float versions `namef' and `__namef'. */
71 #define __MATHCALL(function, args) \
72 __MATHDECL (_Mdouble_complex_,function, args)
73 #define __MATHDECL(type, function, args) \
74 __MATHDECL_1(type, function, args); \
75 __MATHDECL_1(type, __CONCAT(__,function), args)
76 #define __MATHDECL_1(type, function, args) \
77 extern type __MATH_PRECNAME(function) args __THROW
79 #define _Mdouble_ double
80 #define __MATH_PRECNAME(name) name
81 #include <bits/cmathcalls.h>
82 #undef _Mdouble_
83 #undef __MATH_PRECNAME
85 /* Now the float versions. */
86 #ifndef _Mfloat_
87 # define _Mfloat_ float
88 #endif
89 #define _Mdouble_ _Mfloat_
90 #define __MATH_PRECNAME(name) name##f
91 #include <bits/cmathcalls.h>
92 #undef _Mdouble_
93 #undef __MATH_PRECNAME
95 #if (__HAVE_DISTINCT_FLOAT128 || (__HAVE_FLOAT128 && !defined _LIBC)) \
96 && __GLIBC_USE (IEC_60559_TYPES_EXT)
97 # ifndef _Mfloat128_
98 # define _Mfloat128_ _Float128
99 # endif
100 /* GCC < 7 requires extra convincing to expose a complex float128 type. */
101 # ifdef __CFLOAT128
102 # undef _Mdouble_complex_
103 # define _Mdouble_complex_ __CFLOAT128
104 # endif
105 # define _Mdouble_ _Mfloat128_
106 # define __MATH_PRECNAME(name) name##f128
107 # include <bits/cmathcalls.h>
108 # undef _Mdouble_
109 # undef __MATH_PRECNAME
110 # undef _Mdouble_complex_
111 #endif
113 /* And the long double versions. It is non-critical to define them
114 here unconditionally since `long double' is required in ISO C99. */
115 #if !(defined __NO_LONG_DOUBLE_MATH && defined _LIBC) \
116 || defined __LDBL_COMPAT
117 # ifdef __LDBL_COMPAT
118 # undef __MATHDECL_1
119 # define __MATHDECL_1(type, function, args) \
120 extern type __REDIRECT_NTH(__MATH_PRECNAME(function), args, function)
121 # endif
123 # ifndef _Mlong_double_
124 # define _Mlong_double_ long double
125 # endif
126 # define _Mdouble_ _Mlong_double_
127 # define __MATH_PRECNAME(name) name##l
128 # include <bits/cmathcalls.h>
129 #endif
130 #undef _Mdouble_
131 #undef __MATH_PRECNAME
132 #undef __MATHDECL_1
133 #undef __MATHDECL
134 #undef __MATHCALL
136 __END_DECLS
138 #endif /* complex.h */