diff options
author | Thomas Guyot-Sionnest <dermoth@users.sourceforge.net> | 2008-02-12 12:03:58 +0000 |
---|---|---|
committer | Thomas Guyot-Sionnest <dermoth@users.sourceforge.net> | 2008-02-12 12:03:58 +0000 |
commit | abbad00edd7f5f3d33ae77a9d5ac338e5bea5fb3 (patch) | |
tree | 0d55fb4d8e5ad7a9376d1bccdea31104cbecacfe /gl/math.in.h | |
parent | bd7029a99b0c2974265c6665638ef14a052f42ab (diff) | |
download | monitoring-plugins-abbad00edd7f5f3d33ae77a9d5ac338e5bea5fb3.tar.gz |
Import Gnulib floorf and base64 and removed our old base64 library.
git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/trunk@1926 f882894a-f735-0410-b71e-b25c423dba1c
Diffstat (limited to 'gl/math.in.h')
-rw-r--r-- | gl/math.in.h | 413 |
1 files changed, 413 insertions, 0 deletions
diff --git a/gl/math.in.h b/gl/math.in.h new file mode 100644 index 00000000..c3515d73 --- /dev/null +++ b/gl/math.in.h | |||
@@ -0,0 +1,413 @@ | |||
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 3 of the License, or | ||
8 | (at your option) 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, see <http://www.gnu.org/licenses/>. */ | ||
17 | |||
18 | #ifndef _GL_MATH_H | ||
19 | |||
20 | /* The include_next requires a split double-inclusion guard. */ | ||
21 | #@INCLUDE_NEXT@ @NEXT_MATH_H@ | ||
22 | |||
23 | #ifndef _GL_MATH_H | ||
24 | #define _GL_MATH_H | ||
25 | |||
26 | |||
27 | /* The definition of GL_LINK_WARNING is copied here. */ | ||
28 | |||
29 | |||
30 | #ifdef __cplusplus | ||
31 | extern "C" { | ||
32 | #endif | ||
33 | |||
34 | |||
35 | /* Write x as | ||
36 | x = mantissa * 2^exp | ||
37 | where | ||
38 | If x finite and nonzero: 0.5 <= |mantissa| < 1.0. | ||
39 | If x is zero: mantissa = x, exp = 0. | ||
40 | If x is infinite or NaN: mantissa = x, exp unspecified. | ||
41 | Store exp in *EXPPTR and return mantissa. */ | ||
42 | #if @GNULIB_FREXP@ | ||
43 | # if @REPLACE_FREXP@ | ||
44 | # define frexp rpl_frexp | ||
45 | extern double frexp (double x, int *expptr); | ||
46 | # endif | ||
47 | #elif defined GNULIB_POSIXCHECK | ||
48 | # undef frexp | ||
49 | # define frexp(x,e) \ | ||
50 | (GL_LINK_WARNING ("frexp is unportable - " \ | ||
51 | "use gnulib module frexp for portability"), \ | ||
52 | frexp (x, e)) | ||
53 | #endif | ||
54 | |||
55 | |||
56 | #if @GNULIB_MATHL@ || !@HAVE_DECL_ACOSL@ | ||
57 | extern long double acosl (long double x); | ||
58 | #endif | ||
59 | #if !@GNULIB_MATHL@ && defined GNULIB_POSIXCHECK | ||
60 | # undef acosl | ||
61 | # define acosl(x) \ | ||
62 | (GL_LINK_WARNING ("acosl is unportable - " \ | ||
63 | "use gnulib module mathl for portability"), \ | ||
64 | acosl (x)) | ||
65 | #endif | ||
66 | |||
67 | |||
68 | #if @GNULIB_MATHL@ || !@HAVE_DECL_ASINL@ | ||
69 | extern long double asinl (long double x); | ||
70 | #endif | ||
71 | #if !@GNULIB_MATHL@ && defined GNULIB_POSIXCHECK | ||
72 | # undef asinl | ||
73 | # define asinl(x) \ | ||
74 | (GL_LINK_WARNING ("asinl is unportable - " \ | ||
75 | "use gnulib module mathl for portability"), \ | ||
76 | asinl (x)) | ||
77 | #endif | ||
78 | |||
79 | |||
80 | #if @GNULIB_MATHL@ || !@HAVE_DECL_ATANL@ | ||
81 | extern long double atanl (long double x); | ||
82 | #endif | ||
83 | #if !@GNULIB_MATHL@ && defined GNULIB_POSIXCHECK | ||
84 | # undef atanl | ||
85 | # define atanl(x) \ | ||
86 | (GL_LINK_WARNING ("atanl is unportable - " \ | ||
87 | "use gnulib module mathl for portability"), \ | ||
88 | atanl (x)) | ||
89 | #endif | ||
90 | |||
91 | |||
92 | #if @GNULIB_CEILF@ | ||
93 | # if @REPLACE_CEILF@ | ||
94 | # define ceilf rpl_ceilf | ||
95 | extern float ceilf (float x); | ||
96 | # endif | ||
97 | #elif defined GNULIB_POSIXCHECK | ||
98 | # undef ceilf | ||
99 | # define ceilf(x) \ | ||
100 | (GL_LINK_WARNING ("ceilf is unportable - " \ | ||
101 | "use gnulib module ceilf for portability"), \ | ||
102 | ceilf (x)) | ||
103 | #endif | ||
104 | |||
105 | #if @GNULIB_CEILL@ | ||
106 | # if @REPLACE_CEILL@ | ||
107 | # define ceill rpl_ceill | ||
108 | extern long double ceill (long double x); | ||
109 | # endif | ||
110 | #elif defined GNULIB_POSIXCHECK | ||
111 | # undef ceill | ||
112 | # define ceill(x) \ | ||
113 | (GL_LINK_WARNING ("ceill is unportable - " \ | ||
114 | "use gnulib module ceill for portability"), \ | ||
115 | ceill (x)) | ||
116 | #endif | ||
117 | |||
118 | |||
119 | #if @GNULIB_MATHL@ || !@HAVE_DECL_COSL@ | ||
120 | extern long double cosl (long double x); | ||
121 | #endif | ||
122 | #if !@GNULIB_MATHL@ && defined GNULIB_POSIXCHECK | ||
123 | # undef cosl | ||
124 | # define cosl(x) \ | ||
125 | (GL_LINK_WARNING ("cosl is unportable - " \ | ||
126 | "use gnulib module mathl for portability"), \ | ||
127 | cosl (x)) | ||
128 | #endif | ||
129 | |||
130 | |||
131 | #if @GNULIB_MATHL@ || !@HAVE_DECL_EXPL@ | ||
132 | extern long double expl (long double x); | ||
133 | #endif | ||
134 | #if !@GNULIB_MATHL@ && defined GNULIB_POSIXCHECK | ||
135 | # undef expl | ||
136 | # define expl(x) \ | ||
137 | (GL_LINK_WARNING ("expl is unportable - " \ | ||
138 | "use gnulib module mathl for portability"), \ | ||
139 | expl (x)) | ||
140 | #endif | ||
141 | |||
142 | |||
143 | #if @GNULIB_FLOORF@ | ||
144 | # if @REPLACE_FLOORF@ | ||
145 | # define floorf rpl_floorf | ||
146 | extern float floorf (float x); | ||
147 | # endif | ||
148 | #elif defined GNULIB_POSIXCHECK | ||
149 | # undef floorf | ||
150 | # define floorf(x) \ | ||
151 | (GL_LINK_WARNING ("floorf is unportable - " \ | ||
152 | "use gnulib module floorf for portability"), \ | ||
153 | floorf (x)) | ||
154 | #endif | ||
155 | |||
156 | #if @GNULIB_FLOORL@ | ||
157 | # if @REPLACE_FLOORL@ | ||
158 | # define floorl rpl_floorl | ||
159 | extern long double floorl (long double x); | ||
160 | # endif | ||
161 | #elif defined GNULIB_POSIXCHECK | ||
162 | # undef floorl | ||
163 | # define floorl(x) \ | ||
164 | (GL_LINK_WARNING ("floorl is unportable - " \ | ||
165 | "use gnulib module floorl for portability"), \ | ||
166 | floorl (x)) | ||
167 | #endif | ||
168 | |||
169 | |||
170 | /* Write x as | ||
171 | x = mantissa * 2^exp | ||
172 | where | ||
173 | If x finite and nonzero: 0.5 <= |mantissa| < 1.0. | ||
174 | If x is zero: mantissa = x, exp = 0. | ||
175 | If x is infinite or NaN: mantissa = x, exp unspecified. | ||
176 | Store exp in *EXPPTR and return mantissa. */ | ||
177 | #if @GNULIB_FREXPL@ && @REPLACE_FREXPL@ | ||
178 | # define frexpl rpl_frexpl | ||
179 | #endif | ||
180 | #if (@GNULIB_FREXPL@ && @REPLACE_FREXPL@) || !@HAVE_DECL_FREXPL@ | ||
181 | extern long double frexpl (long double x, int *expptr); | ||
182 | #endif | ||
183 | #if !@GNULIB_FREXPL@ && defined GNULIB_POSIXCHECK | ||
184 | # undef frexpl | ||
185 | # define frexpl(x,e) \ | ||
186 | (GL_LINK_WARNING ("frexpl is unportable - " \ | ||
187 | "use gnulib module frexpl for portability"), \ | ||
188 | frexpl (x, e)) | ||
189 | #endif | ||
190 | |||
191 | |||
192 | /* Return x * 2^exp. */ | ||
193 | #if @GNULIB_LDEXPL@ && @REPLACE_LDEXPL@ | ||
194 | # define ldexpl rpl_ldexpl | ||
195 | #endif | ||
196 | #if (@GNULIB_LDEXPL@ && @REPLACE_LDEXPL@) || !@HAVE_DECL_LDEXPL@ | ||
197 | extern long double ldexpl (long double x, int exp); | ||
198 | #endif | ||
199 | #if !@GNULIB_LDEXPL@ && defined GNULIB_POSIXCHECK | ||
200 | # undef ldexpl | ||
201 | # define ldexpl(x,e) \ | ||
202 | (GL_LINK_WARNING ("ldexpl is unportable - " \ | ||
203 | "use gnulib module ldexpl for portability"), \ | ||
204 | ldexpl (x, e)) | ||
205 | #endif | ||
206 | |||
207 | |||
208 | #if @GNULIB_MATHL@ || !@HAVE_DECL_LOGL@ | ||
209 | extern long double logl (long double x); | ||
210 | #endif | ||
211 | #if !@GNULIB_MATHL@ && defined GNULIB_POSIXCHECK | ||
212 | # undef logl | ||
213 | # define logl(x) \ | ||
214 | (GL_LINK_WARNING ("logl is unportable - " \ | ||
215 | "use gnulib module mathl for portability"), \ | ||
216 | logl (x)) | ||
217 | #endif | ||
218 | |||
219 | |||
220 | #if @GNULIB_ROUNDF@ | ||
221 | # if @REPLACE_ROUNDF@ | ||
222 | # undef roundf | ||
223 | # define roundf rpl_roundf | ||
224 | extern float roundf (float x); | ||
225 | # endif | ||
226 | #elif defined GNULIB_POSIXCHECK | ||
227 | # undef roundf | ||
228 | # define roundf(x) \ | ||
229 | (GL_LINK_WARNING ("roundf is unportable - " \ | ||
230 | "use gnulib module roundf for portability"), \ | ||
231 | roundf (x)) | ||
232 | #endif | ||
233 | |||
234 | #if @GNULIB_ROUND@ | ||
235 | # if @REPLACE_ROUND@ | ||
236 | # undef round | ||
237 | # define round rpl_round | ||
238 | extern double round (double x); | ||
239 | # endif | ||
240 | #elif defined GNULIB_POSIXCHECK | ||
241 | # undef round | ||
242 | # define round(x) \ | ||
243 | (GL_LINK_WARNING ("round is unportable - " \ | ||
244 | "use gnulib module round for portability"), \ | ||
245 | round (x)) | ||
246 | #endif | ||
247 | |||
248 | #if @GNULIB_ROUNDL@ | ||
249 | # if @REPLACE_ROUNDL@ | ||
250 | # undef roundl | ||
251 | # define roundl rpl_roundl | ||
252 | extern long double roundl (long double x); | ||
253 | # endif | ||
254 | #elif defined GNULIB_POSIXCHECK | ||
255 | # undef roundl | ||
256 | # define roundl(x) \ | ||
257 | (GL_LINK_WARNING ("roundl is unportable - " \ | ||
258 | "use gnulib module roundl for portability"), \ | ||
259 | roundl (x)) | ||
260 | #endif | ||
261 | |||
262 | |||
263 | #if @GNULIB_MATHL@ || !@HAVE_DECL_SINL@ | ||
264 | extern long double sinl (long double x); | ||
265 | #endif | ||
266 | #if !@GNULIB_MATHL@ && defined GNULIB_POSIXCHECK | ||
267 | # undef sinl | ||
268 | # define sinl(x) \ | ||
269 | (GL_LINK_WARNING ("sinl is unportable - " \ | ||
270 | "use gnulib module mathl for portability"), \ | ||
271 | sinl (x)) | ||
272 | #endif | ||
273 | |||
274 | |||
275 | #if @GNULIB_MATHL@ || !@HAVE_DECL_SQRTL@ | ||
276 | extern long double sqrtl (long double x); | ||
277 | #endif | ||
278 | #if !@GNULIB_MATHL@ && defined GNULIB_POSIXCHECK | ||
279 | # undef sqrtl | ||
280 | # define sqrtl(x) \ | ||
281 | (GL_LINK_WARNING ("sqrtl is unportable - " \ | ||
282 | "use gnulib module mathl for portability"), \ | ||
283 | sqrtl (x)) | ||
284 | #endif | ||
285 | |||
286 | |||
287 | #if @GNULIB_MATHL@ || !@HAVE_DECL_TANL@ | ||
288 | extern long double tanl (long double x); | ||
289 | #endif | ||
290 | #if !@GNULIB_MATHL@ && defined GNULIB_POSIXCHECK | ||
291 | # undef tanl | ||
292 | # define tanl(x) \ | ||
293 | (GL_LINK_WARNING ("tanl is unportable - " \ | ||
294 | "use gnulib module mathl for portability"), \ | ||
295 | tanl (x)) | ||
296 | #endif | ||
297 | |||
298 | |||
299 | #if @GNULIB_TRUNCF@ | ||
300 | # if !@HAVE_DECL_TRUNCF@ | ||
301 | # define truncf rpl_truncf | ||
302 | extern float truncf (float x); | ||
303 | # endif | ||
304 | #elif defined GNULIB_POSIXCHECK | ||
305 | # undef truncf | ||
306 | # define truncf(x) \ | ||
307 | (GL_LINK_WARNING ("truncf is unportable - " \ | ||
308 | "use gnulib module truncf for portability"), \ | ||
309 | truncf (x)) | ||
310 | #endif | ||
311 | |||
312 | #if @GNULIB_TRUNC@ | ||
313 | # if !@HAVE_DECL_TRUNC@ | ||
314 | # define trunc rpl_trunc | ||
315 | extern double trunc (double x); | ||
316 | # endif | ||
317 | #elif defined GNULIB_POSIXCHECK | ||
318 | # undef trunc | ||
319 | # define trunc(x) \ | ||
320 | (GL_LINK_WARNING ("trunc is unportable - " \ | ||
321 | "use gnulib module trunc for portability"), \ | ||
322 | trunc (x)) | ||
323 | #endif | ||
324 | |||
325 | #if @GNULIB_TRUNCL@ | ||
326 | # if !@HAVE_DECL_TRUNCL@ | ||
327 | # define truncl rpl_truncl | ||
328 | extern long double truncl (long double x); | ||
329 | # endif | ||
330 | #elif defined GNULIB_POSIXCHECK | ||
331 | # undef truncl | ||
332 | # define truncl(x) \ | ||
333 | (GL_LINK_WARNING ("truncl is unportable - " \ | ||
334 | "use gnulib module truncl for portability"), \ | ||
335 | truncl (x)) | ||
336 | #endif | ||
337 | |||
338 | |||
339 | #if @GNULIB_ISFINITE@ | ||
340 | # if @REPLACE_ISFINITE@ | ||
341 | extern int gl_isfinitef (float x); | ||
342 | extern int gl_isfinited (double x); | ||
343 | extern int gl_isfinitel (long double x); | ||
344 | # undef isfinite | ||
345 | # define isfinite(x) \ | ||
346 | (sizeof (x) == sizeof (long double) ? gl_isfinitel (x) : \ | ||
347 | sizeof (x) == sizeof (double) ? gl_isfinited (x) : \ | ||
348 | gl_isfinitef (x)) | ||
349 | # endif | ||
350 | #elif defined GNULIB_POSIXCHECK | ||
351 | /* How to override a macro? */ | ||
352 | #endif | ||
353 | |||
354 | |||
355 | #if @GNULIB_SIGNBIT@ | ||
356 | # if @REPLACE_SIGNBIT_USING_GCC@ | ||
357 | # undef signbit | ||
358 | /* GCC 4.0 and newer provides three built-ins for signbit. */ | ||
359 | # define signbit(x) \ | ||
360 | (sizeof (x) == sizeof (long double) ? __builtin_signbitl (x) : \ | ||
361 | sizeof (x) == sizeof (double) ? __builtin_signbit (x) : \ | ||
362 | __builtin_signbitf (x)) | ||
363 | # endif | ||
364 | # if @REPLACE_SIGNBIT@ | ||
365 | # undef signbit | ||
366 | extern int gl_signbitf (float arg); | ||
367 | extern int gl_signbitd (double arg); | ||
368 | extern int gl_signbitl (long double arg); | ||
369 | # if __GNUC__ >= 2 && !__STRICT_ANSI__ | ||
370 | # if defined FLT_SIGNBIT_WORD && defined FLT_SIGNBIT_BIT | ||
371 | # define gl_signbitf(arg) \ | ||
372 | ({ union { float _value; \ | ||
373 | unsigned int _word[(sizeof (float) + sizeof (unsigned int) - 1) / sizeof (unsigned int)]; \ | ||
374 | } _m; \ | ||
375 | _m._value = (arg); \ | ||
376 | (_m._word[FLT_SIGNBIT_WORD] >> FLT_SIGNBIT_BIT) & 1; \ | ||
377 | }) | ||
378 | # endif | ||
379 | # if defined DBL_SIGNBIT_WORD && defined DBL_SIGNBIT_BIT | ||
380 | # define gl_signbitd(arg) \ | ||
381 | ({ union { double _value; \ | ||
382 | unsigned int _word[(sizeof (double) + sizeof (unsigned int) - 1) / sizeof (unsigned int)]; \ | ||
383 | } _m; \ | ||
384 | _m._value = (arg); \ | ||
385 | (_m._word[DBL_SIGNBIT_WORD] >> DBL_SIGNBIT_BIT) & 1; \ | ||
386 | }) | ||
387 | # endif | ||
388 | # if defined LDBL_SIGNBIT_WORD && defined LDBL_SIGNBIT_BIT | ||
389 | # define gl_signbitl(arg) \ | ||
390 | ({ union { long double _value; \ | ||
391 | unsigned int _word[(sizeof (long double) + sizeof (unsigned int) - 1) / sizeof (unsigned int)]; \ | ||
392 | } _m; \ | ||
393 | _m._value = (arg); \ | ||
394 | (_m._word[LDBL_SIGNBIT_WORD] >> LDBL_SIGNBIT_BIT) & 1; \ | ||
395 | }) | ||
396 | # endif | ||
397 | # endif | ||
398 | # define signbit(x) \ | ||
399 | (sizeof (x) == sizeof (long double) ? gl_signbitl (x) : \ | ||
400 | sizeof (x) == sizeof (double) ? gl_signbitd (x) : \ | ||
401 | gl_signbitf (x)) | ||
402 | # endif | ||
403 | #elif defined GNULIB_POSIXCHECK | ||
404 | /* How to override a macro? */ | ||
405 | #endif | ||
406 | |||
407 | |||
408 | #ifdef __cplusplus | ||
409 | } | ||
410 | #endif | ||
411 | |||
412 | #endif /* _GL_MATH_H */ | ||
413 | #endif /* _GL_MATH_H */ | ||