New module 'frexp'.
[gnulib.git] / lib / math_.h
1 /* A GNU-like <math.h>.
2
3    Copyright (C) 2002-2003, 2007 Free Software Foundation, Inc.
4
5    This program is free software; you can redistribute it and/or modify
6    it under the terms of the GNU General Public License as published by
7    the Free Software Foundation; either version 2, or (at your option)
8    any later version.
9
10    This program is distributed in the hope that it will be useful,
11    but WITHOUT ANY WARRANTY; without even the implied warranty of
12    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13    GNU General Public License for more details.
14
15    You should have received a copy of the GNU General Public License
16    along with this program; if not, write to the Free Software Foundation,
17    Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.  */
18
19 #ifndef _GL_MATH_H
20 #define _GL_MATH_H
21
22 #include @ABSOLUTE_MATH_H@
23
24
25 /* The definition of GL_LINK_WARNING is copied here.  */
26
27
28 #ifdef __cplusplus
29 extern "C" {
30 #endif
31
32
33 /* Write x as
34      x = mantissa * 2^exp
35    where
36      If x finite and nonzero: 0.5 <= |mantissa| < 1.0.
37      If x is zero: mantissa = x, exp = 0.
38      If x is infinite or NaN: mantissa = x, exp unspecified.
39    Store exp and return mantissa.  */
40 #if @GNULIB_FREXP@
41 # if @REPLACE_FREXP@
42 #  define frexp rpl_frexp
43 extern double frexp (double x, int *exp);
44 # endif
45 #elif defined GNULIB_POSIXCHECK
46 # undef frexp
47 # define frexp(x,e) \
48     (GL_LINK_WARNING ("frexp is unportable - " \
49                       "use gnulib module frexp for portability"), \
50      frexp (x, e))
51 #endif
52
53
54 #if @GNULIB_MATHL@ || !@HAVE_DECL_ACOSL@
55 extern long double acosl (long double x);
56 #endif
57 #if !@GNULIB_MATHL@ && defined GNULIB_POSIXCHECK
58 # undef acosl
59 # define acosl(x) \
60     (GL_LINK_WARNING ("acosl is unportable - " \
61                       "use gnulib module mathl for portability"), \
62      acosl (x))
63 #endif
64
65 #if @GNULIB_MATHL@ || !@HAVE_DECL_ASINL@
66 extern long double asinl (long double x);
67 #endif
68 #if !@GNULIB_MATHL@ && defined GNULIB_POSIXCHECK
69 # undef asinl
70 # define asinl(x) \
71     (GL_LINK_WARNING ("asinl is unportable - " \
72                       "use gnulib module mathl for portability"), \
73      asinl (x))
74 #endif
75
76 #if @GNULIB_MATHL@ || !@HAVE_DECL_ATANL@
77 extern long double atanl (long double x);
78 #endif
79 #if !@GNULIB_MATHL@ && defined GNULIB_POSIXCHECK
80 # undef atanl
81 # define atanl(x) \
82     (GL_LINK_WARNING ("atanl is unportable - " \
83                       "use gnulib module mathl for portability"), \
84      atanl (x))
85 #endif
86
87 #if @GNULIB_MATHL@ || !@HAVE_DECL_CEILL@
88 extern long double ceill (long double x);
89 #endif
90 #if !@GNULIB_MATHL@ && defined GNULIB_POSIXCHECK
91 # undef ceill
92 # define ceill(x) \
93     (GL_LINK_WARNING ("ceill is unportable - " \
94                       "use gnulib module mathl for portability"), \
95      ceill (x))
96 #endif
97
98 #if @GNULIB_MATHL@ || !@HAVE_DECL_COSL@
99 extern long double cosl (long double x);
100 #endif
101 #if !@GNULIB_MATHL@ && defined GNULIB_POSIXCHECK
102 # undef cosl
103 # define cosl(x) \
104     (GL_LINK_WARNING ("cosl is unportable - " \
105                       "use gnulib module mathl for portability"), \
106      cosl (x))
107 #endif
108
109 #if @GNULIB_MATHL@ || !@HAVE_DECL_EXPL@
110 extern long double expl (long double x);
111 #endif
112 #if !@GNULIB_MATHL@ && defined GNULIB_POSIXCHECK
113 # undef expl
114 # define expl(x) \
115     (GL_LINK_WARNING ("expl is unportable - " \
116                       "use gnulib module mathl for portability"), \
117      expl (x))
118 #endif
119
120 #if @GNULIB_MATHL@ || !@HAVE_DECL_FLOORL@
121 extern long double floorl (long double x);
122 #endif
123 #if !@GNULIB_MATHL@ && defined GNULIB_POSIXCHECK
124 # undef floorl
125 # define floorl(x) \
126     (GL_LINK_WARNING ("floorl is unportable - " \
127                       "use gnulib module mathl for portability"), \
128      floorl (x))
129 #endif
130
131 #if @GNULIB_MATHL@ || !@HAVE_DECL_FREXPL@
132 extern long double frexpl (long double x, int *exp);
133 #endif
134 #if !@GNULIB_MATHL@ && defined GNULIB_POSIXCHECK
135 # undef frexpl
136 # define frexpl(x,e) \
137     (GL_LINK_WARNING ("frexpl is unportable - " \
138                       "use gnulib module mathl for portability"), \
139      frexpl (x, e))
140 #endif
141
142 #if @GNULIB_MATHL@ || !@HAVE_DECL_LDEXPL@
143 extern long double ldexpl (long double x, int exp);
144 #endif
145 #if !@GNULIB_MATHL@ && defined GNULIB_POSIXCHECK
146 # undef ldexpl
147 # define ldexpl(x,e) \
148     (GL_LINK_WARNING ("ldexpl is unportable - " \
149                       "use gnulib module mathl for portability"), \
150      ldexpl (x, e))
151 #endif
152
153 #if @GNULIB_MATHL@ || !@HAVE_DECL_LOGL@
154 extern long double logl (long double x);
155 #endif
156 #if !@GNULIB_MATHL@ && defined GNULIB_POSIXCHECK
157 # undef logl
158 # define logl(x) \
159     (GL_LINK_WARNING ("logl is unportable - " \
160                       "use gnulib module mathl for portability"), \
161      logl (x))
162 #endif
163
164 #if @GNULIB_MATHL@ || !@HAVE_DECL_SINL@
165 extern long double sinl (long double x);
166 #endif
167 #if !@GNULIB_MATHL@ && defined GNULIB_POSIXCHECK
168 # undef sinl
169 # define sinl(x) \
170     (GL_LINK_WARNING ("sinl is unportable - " \
171                       "use gnulib module mathl for portability"), \
172      sinl (x))
173 #endif
174
175 #if @GNULIB_MATHL@ || !@HAVE_DECL_SQRTL@
176 extern long double sqrtl (long double x);
177 #endif
178 #if !@GNULIB_MATHL@ && defined GNULIB_POSIXCHECK
179 # undef sqrtl
180 # define sqrtl(x) \
181     (GL_LINK_WARNING ("sqrtl is unportable - " \
182                       "use gnulib module mathl for portability"), \
183      sqrtl (x))
184 #endif
185
186 #if @GNULIB_MATHL@ || !@HAVE_DECL_TANL@
187 extern long double tanl (long double x);
188 #endif
189 #if !@GNULIB_MATHL@ && defined GNULIB_POSIXCHECK
190 # undef tanl
191 # define tanl(x) \
192     (GL_LINK_WARNING ("tanl is unportable - " \
193                       "use gnulib module mathl for portability"), \
194      tanl (x))
195 #endif
196
197
198 #ifdef __cplusplus
199 }
200 #endif
201
202 #endif