Update.
[platform/upstream/glibc.git] / math / complex.h
1 /* Copyright (C) 1997 Free Software Foundation, Inc.
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
25 #define _COMPLEX_H      1
26 #include <features.h>
27
28 __BEGIN_DECLS
29
30 /* We might need to add support for more compilers here.  But once ISO
31    C 9X is out hopefully all maintained compilers will provide the data
32    types `float complex' and `double complex'.  */
33 #if (__GNUC__ == 2 && __GNUC_MINOR__ >= 7) || __GNUC__ > 2
34 # define complex __complex__
35 #endif
36
37
38 /* Narrowest imaginary unit.  This depends on the floating-point
39    evaluation method.
40    XXX This probably has to go into a gcc related file.  */
41 #define _Imaginary_I    (DBL_EPSISON * 1.0i)
42
43 /* Another more descriptive name is `I'.  */
44 #undef I
45 #define I _Imaginary_I
46
47
48 /* Optimization aids.  This is not yet implemented in gcc and once it
49    is this will probably be available in a gcc header.  */
50 #define CX_LIMITED_RANGE_ON
51 #define CX_LIMITED_RANGE_OFF
52 #define CX_LIMITED_RANGE_DEFAULT
53
54
55 /* The file <cmathcalls.h> contains the prototypes for all the actual
56    math functions.  These macros are used for those prototypes, so
57    we can easily declare each function as both `name' and `__name',
58    and can declare the float versions `namef' and `__namef'.  */
59
60 #define __MATHCALL(function, args)      \
61   __MATHDECL (_Mdouble_complex_,function, args)
62 #define __MATHDECL(type, function, args) \
63   __MATHDECL_1(type, function, args); \
64   __MATHDECL_1(type, __CONCAT(__,function), args)
65 #define __MATHDECL_1(type, function, args) \
66   extern type __MATH_PRECNAME(function) args
67
68 #define _Mdouble_               double
69 #define __MATH_PRECNAME(name)   name
70 #include <cmathcalls.h>
71 #undef  _Mdouble_
72 #undef  __MATH_PRECNAME
73
74 /* Now the float versions.  */
75 #ifndef _Mfloat_
76 #define _Mfloat_                float
77 #endif
78 #define _Mdouble_               _Mfloat_
79 #ifdef __STDC__
80 #define __MATH_PRECNAME(name)   name##f
81 #else
82 #define __MATH_PRECNAME(name)   name/**/f
83 #endif
84 #include <cmathcalls.h>
85 #undef  _Mdouble_
86 #undef  __MATH_PRECNAME
87
88 /* And the long double versions.  It is non-critical to define them
89    here unconditionally since `long double' is required in ISO C 9X.  */
90 #ifndef _Mlong_double_
91 #define _Mlong_double_          long double
92 #endif
93 #define _Mdouble_               _Mlong_double_
94 #ifdef __STDC__
95 #define __MATH_PRECNAME(name)   name##l
96 #else
97 #define __MATH_PRECNAME(name)   name/**/l
98 #endif
99 #include <cmathcalls.h>
100 #undef  _Mdouble_
101 #undef  __MATH_PRECNAME
102 #undef  __MATHDECL_1
103 #undef  __MATHDECL
104 #undef  __MATHCALL
105
106 __END_DECLS
107
108 #endif /* complex.h */