asinl: Provide function definition on MSVC.
[gnulib.git] / lib / math.in.h
1 /* A GNU-like <math.h>.
2
3    Copyright (C) 2002-2003, 2007-2012 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 _@GUARD_PREFIX@_MATH_H
19
20 #if __GNUC__ >= 3
21 @PRAGMA_SYSTEM_HEADER@
22 #endif
23 @PRAGMA_COLUMNS@
24
25 /* The include_next requires a split double-inclusion guard.  */
26 #@INCLUDE_NEXT_AS_FIRST_DIRECTIVE@ @NEXT_AS_FIRST_DIRECTIVE_MATH_H@
27
28 #ifndef _@GUARD_PREFIX@_MATH_H
29 #define _@GUARD_PREFIX@_MATH_H
30
31
32 /* The definitions of _GL_FUNCDECL_RPL etc. are copied here.  */
33
34 /* The definition of _GL_ARG_NONNULL is copied here.  */
35
36 /* The definition of _GL_WARN_ON_USE is copied here.  */
37
38 #ifdef __cplusplus
39 /* Helper macros to define type-generic function FUNC as overloaded functions,
40    rather than as macros like in C.  POSIX declares these with an argument of
41    real-floating (that is, one of float, double, or long double).  */
42 # define _GL_MATH_CXX_REAL_FLOATING_DECL_1(func) \
43 static inline int                                                   \
44 _gl_cxx_ ## func ## f (float f)                                     \
45 {                                                                   \
46   return func (f);                                                  \
47 }                                                                   \
48 static inline int                                                   \
49 _gl_cxx_ ## func ## d (double d)                                    \
50 {                                                                   \
51   return func (d);                                                  \
52 }                                                                   \
53 static inline int                                                   \
54 _gl_cxx_ ## func ## l (long double l)                               \
55 {                                                                   \
56   return func (l);                                                  \
57 }
58 # define _GL_MATH_CXX_REAL_FLOATING_DECL_2(func) \
59 inline int                                                          \
60 func (float f)                                                      \
61 {                                                                   \
62   return _gl_cxx_ ## func ## f (f);                                 \
63 }                                                                   \
64 inline int                                                          \
65 func (double d)                                                     \
66 {                                                                   \
67   return _gl_cxx_ ## func ## d (d);                                 \
68 }                                                                   \
69 inline int                                                          \
70 func (long double l)                                                \
71 {                                                                   \
72   return _gl_cxx_ ## func ## l (l);                                 \
73 }
74 #endif
75
76 /* Helper macros to define a portability warning for the
77    classification macro FUNC called with VALUE.  POSIX declares the
78    classification macros with an argument of real-floating (that is,
79    one of float, double, or long double).  */
80 #define _GL_WARN_REAL_FLOATING_DECL(func) \
81 static inline int                                                   \
82 rpl_ ## func ## f (float f)                                         \
83 {                                                                   \
84   return func (f);                                                  \
85 }                                                                   \
86 static inline int                                                   \
87 rpl_ ## func ## d (double d)                                        \
88 {                                                                   \
89   return func (d);                                                  \
90 }                                                                   \
91 static inline int                                                   \
92 rpl_ ## func ## l (long double l)                                   \
93 {                                                                   \
94   return func (l);                                                  \
95 }                                                                   \
96 _GL_WARN_ON_USE (rpl_ ## func ## f, #func " is unportable - "       \
97                  "use gnulib module " #func " for portability");    \
98 _GL_WARN_ON_USE (rpl_ ## func ## d, #func " is unportable - "       \
99                  "use gnulib module " #func " for portability");    \
100 _GL_WARN_ON_USE (rpl_ ## func ## l, #func " is unportable - "       \
101                  "use gnulib module " #func " for portability")
102 #define _GL_WARN_REAL_FLOATING_IMPL(func, value) \
103   (sizeof (value) == sizeof (float) ? rpl_ ## func ## f (value)     \
104    : sizeof (value) == sizeof (double) ? rpl_ ## func ## d (value)  \
105    : rpl_ ## func ## l (value))
106
107
108 #if @REPLACE_ITOLD@
109 /* Pull in a function that fixes the 'int' to 'long double' conversion
110    of glibc 2.7.  */
111 _GL_EXTERN_C void _Qp_itoq (long double *, int);
112 static void (*_gl_math_fix_itold) (long double *, int) = _Qp_itoq;
113 #endif
114
115
116 /* POSIX allows platforms that don't support NAN.  But all major
117    machines in the past 15 years have supported something close to
118    IEEE NaN, so we define this unconditionally.  We also must define
119    it on platforms like Solaris 10, where NAN is present but defined
120    as a function pointer rather than a floating point constant.  */
121 #if !defined NAN || @REPLACE_NAN@
122 # if !GNULIB_defined_NAN
123 #  undef NAN
124   /* The Compaq (ex-DEC) C 6.4 compiler and the Microsoft MSVC 9 compiler
125      choke on the expression 0.0 / 0.0.  */
126 #  if defined __DECC || defined _MSC_VER
127 static float
128 _NaN ()
129 {
130   static float zero = 0.0f;
131   return zero / zero;
132 }
133 #   define NAN (_NaN())
134 #  else
135 #   define NAN (0.0f / 0.0f)
136 #  endif
137 #  define GNULIB_defined_NAN 1
138 # endif
139 #endif
140
141 /* Solaris 10 defines HUGE_VAL, but as a function pointer rather
142    than a floating point constant.  */
143 #if @REPLACE_HUGE_VAL@
144 # undef HUGE_VAL
145 # define HUGE_VAL (1.0 / 0.0)
146 #endif
147
148
149 #if @GNULIB_ACOSF@
150 # if !@HAVE_ACOSF@
151 #  undef acosf
152 _GL_FUNCDECL_SYS (acosf, float, (float x));
153 # endif
154 _GL_CXXALIAS_SYS (acosf, float, (float x));
155 _GL_CXXALIASWARN (acosf);
156 #elif defined GNULIB_POSIXCHECK
157 # undef acosf
158 # if HAVE_RAW_DECL_ACOSF
159 _GL_WARN_ON_USE (acosf, "acosf is unportable - "
160                  "use gnulib module acosf for portability");
161 # endif
162 #endif
163
164 #if @GNULIB_ACOSL@
165 # if !@HAVE_ACOSL@ || !@HAVE_DECL_ACOSL@
166 _GL_FUNCDECL_SYS (acosl, long double, (long double x));
167 # endif
168 _GL_CXXALIAS_SYS (acosl, long double, (long double x));
169 _GL_CXXALIASWARN (acosl);
170 #elif defined GNULIB_POSIXCHECK
171 # undef acosl
172 # if HAVE_RAW_DECL_ACOSL
173 _GL_WARN_ON_USE (acosl, "acosl is unportable - "
174                  "use gnulib module mathl for portability");
175 # endif
176 #endif
177
178
179 #if @GNULIB_ASINF@
180 # if !@HAVE_ASINF@
181 #  undef asinf
182 _GL_FUNCDECL_SYS (asinf, float, (float x));
183 # endif
184 _GL_CXXALIAS_SYS (asinf, float, (float x));
185 _GL_CXXALIASWARN (asinf);
186 #elif defined GNULIB_POSIXCHECK
187 # undef asinf
188 # if HAVE_RAW_DECL_ASINF
189 _GL_WARN_ON_USE (asinf, "asinf is unportable - "
190                  "use gnulib module asinf for portability");
191 # endif
192 #endif
193
194 #if @GNULIB_ASINL@
195 # if !@HAVE_ASINL@ || !@HAVE_DECL_ASINL@
196 #  undef asinl
197 _GL_FUNCDECL_SYS (asinl, long double, (long double x));
198 # endif
199 _GL_CXXALIAS_SYS (asinl, long double, (long double x));
200 _GL_CXXALIASWARN (asinl);
201 #elif defined GNULIB_POSIXCHECK
202 # undef asinl
203 # if HAVE_RAW_DECL_ASINL
204 _GL_WARN_ON_USE (asinl, "asinl is unportable - "
205                  "use gnulib module mathl for portability");
206 # endif
207 #endif
208
209
210 #if @GNULIB_ATANF@
211 # if !@HAVE_ATANF@
212 #  undef atanf
213 _GL_FUNCDECL_SYS (atanf, float, (float x));
214 # endif
215 _GL_CXXALIAS_SYS (atanf, float, (float x));
216 _GL_CXXALIASWARN (atanf);
217 #elif defined GNULIB_POSIXCHECK
218 # undef atanf
219 # if HAVE_RAW_DECL_ATANF
220 _GL_WARN_ON_USE (atanf, "atanf is unportable - "
221                  "use gnulib module atanf for portability");
222 # endif
223 #endif
224
225 #if @GNULIB_ATANL@
226 # if !@HAVE_ATANL@ || !@HAVE_DECL_ATANL@
227 _GL_FUNCDECL_SYS (atanl, long double, (long double x));
228 # endif
229 _GL_CXXALIAS_SYS (atanl, long double, (long double x));
230 _GL_CXXALIASWARN (atanl);
231 #elif defined GNULIB_POSIXCHECK
232 # undef atanl
233 # if HAVE_RAW_DECL_ATANL
234 _GL_WARN_ON_USE (atanl, "atanl is unportable - "
235                  "use gnulib module mathl for portability");
236 # endif
237 #endif
238
239
240 #if @GNULIB_ATAN2F@
241 # if !@HAVE_ATAN2F@
242 #  undef atan2f
243 _GL_FUNCDECL_SYS (atan2f, float, (float y, float x));
244 # endif
245 _GL_CXXALIAS_SYS (atan2f, float, (float y, float x));
246 _GL_CXXALIASWARN (atan2f);
247 #elif defined GNULIB_POSIXCHECK
248 # undef atan2f
249 # if HAVE_RAW_DECL_ATAN2F
250 _GL_WARN_ON_USE (atan2f, "atan2f is unportable - "
251                  "use gnulib module atan2f for portability");
252 # endif
253 #endif
254
255
256 #if @GNULIB_CEILF@
257 # if @REPLACE_CEILF@
258 #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
259 #   undef ceilf
260 #   define ceilf rpl_ceilf
261 #  endif
262 _GL_FUNCDECL_RPL (ceilf, float, (float x));
263 _GL_CXXALIAS_RPL (ceilf, float, (float x));
264 # else
265 #  if !@HAVE_DECL_CEILF@
266 #   undef ceilf
267 _GL_FUNCDECL_SYS (ceilf, float, (float x));
268 #  endif
269 _GL_CXXALIAS_SYS (ceilf, float, (float x));
270 # endif
271 _GL_CXXALIASWARN (ceilf);
272 #elif defined GNULIB_POSIXCHECK
273 # undef ceilf
274 # if HAVE_RAW_DECL_CEILF
275 _GL_WARN_ON_USE (ceilf, "ceilf is unportable - "
276                  "use gnulib module ceilf for portability");
277 # endif
278 #endif
279
280 #if @GNULIB_CEIL@
281 # if @REPLACE_CEIL@
282 #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
283 #   define ceil rpl_ceil
284 #  endif
285 _GL_FUNCDECL_RPL (ceil, double, (double x));
286 _GL_CXXALIAS_RPL (ceil, double, (double x));
287 # else
288 _GL_CXXALIAS_SYS (ceil, double, (double x));
289 # endif
290 _GL_CXXALIASWARN (ceil);
291 #endif
292
293 #if @GNULIB_CEILL@
294 # if @REPLACE_CEILL@
295 #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
296 #   undef ceill
297 #   define ceill rpl_ceill
298 #  endif
299 _GL_FUNCDECL_RPL (ceill, long double, (long double x));
300 _GL_CXXALIAS_RPL (ceill, long double, (long double x));
301 # else
302 #  if !@HAVE_DECL_CEILL@
303 #   undef ceill
304 _GL_FUNCDECL_SYS (ceill, long double, (long double x));
305 #  endif
306 _GL_CXXALIAS_SYS (ceill, long double, (long double x));
307 # endif
308 _GL_CXXALIASWARN (ceill);
309 #elif defined GNULIB_POSIXCHECK
310 # undef ceill
311 # if HAVE_RAW_DECL_CEILL
312 _GL_WARN_ON_USE (ceill, "ceill is unportable - "
313                  "use gnulib module ceill for portability");
314 # endif
315 #endif
316
317
318 #if @GNULIB_COPYSIGNF@
319 # if !@HAVE_COPYSIGNF@
320 _GL_FUNCDECL_SYS (copysignf, float, (float x, float y));
321 # endif
322 _GL_CXXALIAS_SYS (copysignf, float, (float x, float y));
323 _GL_CXXALIASWARN (copysignf);
324 #elif defined GNULIB_POSIXCHECK
325 # undef copysignf
326 # if HAVE_RAW_DECL_COPYSIGNF
327 _GL_WARN_ON_USE (copysignf, "copysignf is unportable - "
328                  "use gnulib module copysignf for portability");
329 # endif
330 #endif
331
332 #if @GNULIB_COPYSIGN@
333 # if !@HAVE_COPYSIGN@
334 _GL_FUNCDECL_SYS (copysign, double, (double x, double y));
335 # endif
336 _GL_CXXALIAS_SYS (copysign, double, (double x, double y));
337 _GL_CXXALIASWARN (copysign);
338 #elif defined GNULIB_POSIXCHECK
339 # undef copysign
340 # if HAVE_RAW_DECL_COPYSIGN
341 _GL_WARN_ON_USE (copysign, "copysign is unportable - "
342                  "use gnulib module copysign for portability");
343 # endif
344 #endif
345
346 #if @GNULIB_COPYSIGNL@
347 # if !@HAVE_COPYSIGNL@
348 _GL_FUNCDECL_SYS (copysignl, long double, (long double x, long double y));
349 # endif
350 _GL_CXXALIAS_SYS (copysignl, long double, (long double x, long double y));
351 _GL_CXXALIASWARN (copysignl);
352 #elif defined GNULIB_POSIXCHECK
353 # undef copysignl
354 # if HAVE_RAW_DECL_COPYSIGNL
355 _GL_WARN_ON_USE (copysign, "copysignl is unportable - "
356                  "use gnulib module copysignl for portability");
357 # endif
358 #endif
359
360
361 #if @GNULIB_COSF@
362 # if !@HAVE_COSF@
363 #  undef cosf
364 _GL_FUNCDECL_SYS (cosf, float, (float x));
365 # endif
366 _GL_CXXALIAS_SYS (cosf, float, (float x));
367 _GL_CXXALIASWARN (cosf);
368 #elif defined GNULIB_POSIXCHECK
369 # undef cosf
370 # if HAVE_RAW_DECL_COSF
371 _GL_WARN_ON_USE (cosf, "cosf is unportable - "
372                  "use gnulib module cosf for portability");
373 # endif
374 #endif
375
376 #if @GNULIB_COSL@
377 # if !@HAVE_COSL@ || !@HAVE_DECL_COSL@
378 #  undef cosl
379 _GL_FUNCDECL_SYS (cosl, long double, (long double x));
380 # endif
381 _GL_CXXALIAS_SYS (cosl, long double, (long double x));
382 _GL_CXXALIASWARN (cosl);
383 #elif defined GNULIB_POSIXCHECK
384 # undef cosl
385 # if HAVE_RAW_DECL_COSL
386 _GL_WARN_ON_USE (cosl, "cosl is unportable - "
387                  "use gnulib module mathl for portability");
388 # endif
389 #endif
390
391
392 #if @GNULIB_COSHF@
393 # if !@HAVE_COSHF@
394 #  undef coshf
395 _GL_FUNCDECL_SYS (coshf, float, (float x));
396 # endif
397 _GL_CXXALIAS_SYS (coshf, float, (float x));
398 _GL_CXXALIASWARN (coshf);
399 #elif defined GNULIB_POSIXCHECK
400 # undef coshf
401 # if HAVE_RAW_DECL_COSHF
402 _GL_WARN_ON_USE (coshf, "coshf is unportable - "
403                  "use gnulib module coshf for portability");
404 # endif
405 #endif
406
407
408 #if @GNULIB_EXPF@
409 # if !@HAVE_EXPF@
410 #  undef expf
411 _GL_FUNCDECL_SYS (expf, float, (float x));
412 # endif
413 _GL_CXXALIAS_SYS (expf, float, (float x));
414 _GL_CXXALIASWARN (expf);
415 #elif defined GNULIB_POSIXCHECK
416 # undef expf
417 # if HAVE_RAW_DECL_EXPF
418 _GL_WARN_ON_USE (expf, "expf is unportable - "
419                  "use gnulib module expf for portability");
420 # endif
421 #endif
422
423 #if @GNULIB_EXPL@
424 # if !@HAVE_EXPL@ || !@HAVE_DECL_EXPL@
425 #  undef expl
426 _GL_FUNCDECL_SYS (expl, long double, (long double x));
427 # endif
428 _GL_CXXALIAS_SYS (expl, long double, (long double x));
429 _GL_CXXALIASWARN (expl);
430 #elif defined GNULIB_POSIXCHECK
431 # undef expl
432 # if HAVE_RAW_DECL_EXPL
433 _GL_WARN_ON_USE (expl, "expl is unportable - "
434                  "use gnulib module mathl for portability");
435 # endif
436 #endif
437
438
439 #if @GNULIB_FABSF@
440 # if !@HAVE_FABSF@
441 #  undef fabsf
442 _GL_FUNCDECL_SYS (fabsf, float, (float x));
443 # endif
444 _GL_CXXALIAS_SYS (fabsf, float, (float x));
445 _GL_CXXALIASWARN (fabsf);
446 #elif defined GNULIB_POSIXCHECK
447 # undef fabsf
448 # if HAVE_RAW_DECL_FABSF
449 _GL_WARN_ON_USE (fabsf, "fabsf is unportable - "
450                  "use gnulib module fabsf for portability");
451 # endif
452 #endif
453
454
455 #if @GNULIB_FLOORF@
456 # if @REPLACE_FLOORF@
457 #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
458 #   undef floorf
459 #   define floorf rpl_floorf
460 #  endif
461 _GL_FUNCDECL_RPL (floorf, float, (float x));
462 _GL_CXXALIAS_RPL (floorf, float, (float x));
463 # else
464 #  if !@HAVE_DECL_FLOORF@
465 #   undef floorf
466 _GL_FUNCDECL_SYS (floorf, float, (float x));
467 #  endif
468 _GL_CXXALIAS_SYS (floorf, float, (float x));
469 # endif
470 _GL_CXXALIASWARN (floorf);
471 #elif defined GNULIB_POSIXCHECK
472 # undef floorf
473 # if HAVE_RAW_DECL_FLOORF
474 _GL_WARN_ON_USE (floorf, "floorf is unportable - "
475                  "use gnulib module floorf for portability");
476 # endif
477 #endif
478
479 #if @GNULIB_FLOOR@
480 # if @REPLACE_FLOOR@
481 #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
482 #   define floor rpl_floor
483 #  endif
484 _GL_FUNCDECL_RPL (floor, double, (double x));
485 _GL_CXXALIAS_RPL (floor, double, (double x));
486 # else
487 _GL_CXXALIAS_SYS (floor, double, (double x));
488 # endif
489 _GL_CXXALIASWARN (floor);
490 #endif
491
492 #if @GNULIB_FLOORL@
493 # if @REPLACE_FLOORL@
494 #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
495 #   undef floorl
496 #   define floorl rpl_floorl
497 #  endif
498 _GL_FUNCDECL_RPL (floorl, long double, (long double x));
499 _GL_CXXALIAS_RPL (floorl, long double, (long double x));
500 # else
501 #  if !@HAVE_DECL_FLOORL@
502 #   undef floorl
503 _GL_FUNCDECL_SYS (floorl, long double, (long double x));
504 #  endif
505 _GL_CXXALIAS_SYS (floorl, long double, (long double x));
506 # endif
507 _GL_CXXALIASWARN (floorl);
508 #elif defined GNULIB_POSIXCHECK
509 # undef floorl
510 # if HAVE_RAW_DECL_FLOORL
511 _GL_WARN_ON_USE (floorl, "floorl is unportable - "
512                  "use gnulib module floorl for portability");
513 # endif
514 #endif
515
516
517 #if @GNULIB_FMAF@
518 # if @REPLACE_FMAF@
519 #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
520 #   undef fmaf
521 #   define fmaf rpl_fmaf
522 #  endif
523 _GL_FUNCDECL_RPL (fmaf, float, (float x, float y, float z));
524 _GL_CXXALIAS_RPL (fmaf, float, (float x, float y, float z));
525 # else
526 #  if !@HAVE_FMAF@
527 _GL_FUNCDECL_SYS (fmaf, float, (float x, float y, float z));
528 #  endif
529 _GL_CXXALIAS_SYS (fmaf, float, (float x, float y, float z));
530 # endif
531 _GL_CXXALIASWARN (fmaf);
532 #elif defined GNULIB_POSIXCHECK
533 # undef fmaf
534 # if HAVE_RAW_DECL_FMAF
535 _GL_WARN_ON_USE (fmaf, "fmaf is unportable - "
536                  "use gnulib module fmaf for portability");
537 # endif
538 #endif
539
540 #if @GNULIB_FMA@
541 # if @REPLACE_FMA@
542 #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
543 #   undef fma
544 #   define fma rpl_fma
545 #  endif
546 _GL_FUNCDECL_RPL (fma, double, (double x, double y, double z));
547 _GL_CXXALIAS_RPL (fma, double, (double x, double y, double z));
548 # else
549 #  if !@HAVE_FMA@
550 _GL_FUNCDECL_SYS (fma, double, (double x, double y, double z));
551 #  endif
552 _GL_CXXALIAS_SYS (fma, double, (double x, double y, double z));
553 # endif
554 _GL_CXXALIASWARN (fma);
555 #elif defined GNULIB_POSIXCHECK
556 # undef fma
557 # if HAVE_RAW_DECL_FMA
558 _GL_WARN_ON_USE (fma, "fma is unportable - "
559                  "use gnulib module fma for portability");
560 # endif
561 #endif
562
563 #if @GNULIB_FMAL@
564 # if @REPLACE_FMAL@
565 #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
566 #   undef fmal
567 #   define fmal rpl_fmal
568 #  endif
569 _GL_FUNCDECL_RPL (fmal, long double,
570                   (long double x, long double y, long double z));
571 _GL_CXXALIAS_RPL (fmal, long double,
572                   (long double x, long double y, long double z));
573 # else
574 #  if !@HAVE_FMAL@
575 _GL_FUNCDECL_SYS (fmal, long double,
576                   (long double x, long double y, long double z));
577 #  endif
578 _GL_CXXALIAS_SYS (fmal, long double,
579                   (long double x, long double y, long double z));
580 # endif
581 _GL_CXXALIASWARN (fmal);
582 #elif defined GNULIB_POSIXCHECK
583 # undef fmal
584 # if HAVE_RAW_DECL_FMAL
585 _GL_WARN_ON_USE (fmal, "fmal is unportable - "
586                  "use gnulib module fmal for portability");
587 # endif
588 #endif
589
590
591 #if @GNULIB_FMODF@
592 # if !@HAVE_FMODF@
593 #  undef fmodf
594 _GL_FUNCDECL_SYS (fmodf, float, (float x, float y));
595 # endif
596 _GL_CXXALIAS_SYS (fmodf, float, (float x, float y));
597 _GL_CXXALIASWARN (fmodf);
598 #elif defined GNULIB_POSIXCHECK
599 # undef fmodf
600 # if HAVE_RAW_DECL_FMODF
601 _GL_WARN_ON_USE (fmodf, "fmodf is unportable - "
602                  "use gnulib module fmodf for portability");
603 # endif
604 #endif
605
606
607 /* Write x as
608      x = mantissa * 2^exp
609    where
610      If x finite and nonzero: 0.5 <= |mantissa| < 1.0.
611      If x is zero: mantissa = x, exp = 0.
612      If x is infinite or NaN: mantissa = x, exp unspecified.
613    Store exp in *EXPPTR and return mantissa.  */
614 #if @GNULIB_FREXPF@
615 # if @REPLACE_FREXPF@
616 #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
617 #   undef frexpf
618 #   define frexpf rpl_frexpf
619 #  endif
620 _GL_FUNCDECL_RPL (frexpf, float, (float x, int *expptr) _GL_ARG_NONNULL ((2)));
621 _GL_CXXALIAS_RPL (frexpf, float, (float x, int *expptr));
622 # else
623 #  if !@HAVE_FREXPF@
624 #   undef frexpf
625 _GL_FUNCDECL_SYS (frexpf, float, (float x, int *expptr) _GL_ARG_NONNULL ((2)));
626 #  endif
627 _GL_CXXALIAS_SYS (frexpf, float, (float x, int *expptr));
628 # endif
629 _GL_CXXALIASWARN (frexpf);
630 #elif defined GNULIB_POSIXCHECK
631 # undef frexpf
632 # if HAVE_RAW_DECL_FREXPF
633 _GL_WARN_ON_USE (frexpf, "frexpf is unportable - "
634                  "use gnulib module frexpf for portability");
635 # endif
636 #endif
637
638 /* Write x as
639      x = mantissa * 2^exp
640    where
641      If x finite and nonzero: 0.5 <= |mantissa| < 1.0.
642      If x is zero: mantissa = x, exp = 0.
643      If x is infinite or NaN: mantissa = x, exp unspecified.
644    Store exp in *EXPPTR and return mantissa.  */
645 #if @GNULIB_FREXP@
646 # if @REPLACE_FREXP@
647 #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
648 #   define frexp rpl_frexp
649 #  endif
650 _GL_FUNCDECL_RPL (frexp, double, (double x, int *expptr) _GL_ARG_NONNULL ((2)));
651 _GL_CXXALIAS_RPL (frexp, double, (double x, int *expptr));
652 # else
653 _GL_CXXALIAS_SYS (frexp, double, (double x, int *expptr));
654 # endif
655 _GL_CXXALIASWARN (frexp);
656 #elif defined GNULIB_POSIXCHECK
657 # undef frexp
658 /* Assume frexp is always declared.  */
659 _GL_WARN_ON_USE (frexp, "frexp is unportable - "
660                  "use gnulib module frexp for portability");
661 #endif
662
663 /* Write x as
664      x = mantissa * 2^exp
665    where
666      If x finite and nonzero: 0.5 <= |mantissa| < 1.0.
667      If x is zero: mantissa = x, exp = 0.
668      If x is infinite or NaN: mantissa = x, exp unspecified.
669    Store exp in *EXPPTR and return mantissa.  */
670 #if @GNULIB_FREXPL@ && @REPLACE_FREXPL@
671 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
672 #  undef frexpl
673 #  define frexpl rpl_frexpl
674 # endif
675 _GL_FUNCDECL_RPL (frexpl, long double,
676                   (long double x, int *expptr) _GL_ARG_NONNULL ((2)));
677 _GL_CXXALIAS_RPL (frexpl, long double, (long double x, int *expptr));
678 #else
679 # if !@HAVE_DECL_FREXPL@
680 _GL_FUNCDECL_SYS (frexpl, long double,
681                   (long double x, int *expptr) _GL_ARG_NONNULL ((2)));
682 # endif
683 # if @GNULIB_FREXPL@
684 _GL_CXXALIAS_SYS (frexpl, long double, (long double x, int *expptr));
685 # endif
686 #endif
687 #if @GNULIB_FREXPL@ && !(@REPLACE_FREXPL@ && !@HAVE_DECL_FREXPL@)
688 _GL_CXXALIASWARN (frexpl);
689 #endif
690 #if !@GNULIB_FREXPL@ && defined GNULIB_POSIXCHECK
691 # undef frexpl
692 # if HAVE_RAW_DECL_FREXPL
693 _GL_WARN_ON_USE (frexpl, "frexpl is unportable - "
694                  "use gnulib module frexpl for portability");
695 # endif
696 #endif
697
698
699 /* Return x * 2^exp.  */
700 #if @GNULIB_LDEXPF@
701 # if !@HAVE_LDEXPF@
702 #  undef ldexpf
703 _GL_FUNCDECL_SYS (ldexpf, float, (float x, int exp));
704 # endif
705 _GL_CXXALIAS_SYS (ldexpf, float, (float x, int exp));
706 _GL_CXXALIASWARN (ldexpf);
707 #elif defined GNULIB_POSIXCHECK
708 # undef ldexpf
709 # if HAVE_RAW_DECL_LDEXPF
710 _GL_WARN_ON_USE (ldexpf, "ldexpf is unportable - "
711                  "use gnulib module ldexpf for portability");
712 # endif
713 #endif
714
715 /* Return x * 2^exp.  */
716 #if @GNULIB_LDEXPL@ && @REPLACE_LDEXPL@
717 # if !(defined __cplusplus && defined GNULIB_NAMESPACE)
718 #  undef ldexpl
719 #  define ldexpl rpl_ldexpl
720 # endif
721 _GL_FUNCDECL_RPL (ldexpl, long double, (long double x, int exp));
722 _GL_CXXALIAS_RPL (ldexpl, long double, (long double x, int exp));
723 #else
724 # if !@HAVE_DECL_LDEXPL@
725 _GL_FUNCDECL_SYS (ldexpl, long double, (long double x, int exp));
726 # endif
727 # if @GNULIB_LDEXPL@
728 _GL_CXXALIAS_SYS (ldexpl, long double, (long double x, int exp));
729 # endif
730 #endif
731 #if @GNULIB_LDEXPL@
732 _GL_CXXALIASWARN (ldexpl);
733 #endif
734 #if !@GNULIB_LDEXPL@ && defined GNULIB_POSIXCHECK
735 # undef ldexpl
736 # if HAVE_RAW_DECL_LDEXPL
737 _GL_WARN_ON_USE (ldexpl, "ldexpl is unportable - "
738                  "use gnulib module ldexpl for portability");
739 # endif
740 #endif
741
742
743 #if @GNULIB_LOGB@
744 # if !@HAVE_DECL_LOGB@
745 _GL_EXTERN_C double logb (double x);
746 # endif
747 #elif defined GNULIB_POSIXCHECK
748 # undef logb
749 # if HAVE_RAW_DECL_LOGB
750 _GL_WARN_ON_USE (logb, "logb is unportable - "
751                  "use gnulib module logb for portability");
752 # endif
753 #endif
754
755
756 #if @GNULIB_LOGF@
757 # if !@HAVE_LOGF@
758 #  undef logf
759 _GL_FUNCDECL_SYS (logf, float, (float x));
760 # endif
761 _GL_CXXALIAS_SYS (logf, float, (float x));
762 _GL_CXXALIASWARN (logf);
763 #elif defined GNULIB_POSIXCHECK
764 # undef logf
765 # if HAVE_RAW_DECL_LOGF
766 _GL_WARN_ON_USE (logf, "logf is unportable - "
767                  "use gnulib module logf for portability");
768 # endif
769 #endif
770
771 #if @GNULIB_LOGL@
772 # if !@HAVE_LOGL@ || !@HAVE_DECL_LOGL@
773 #  undef logl
774 _GL_FUNCDECL_SYS (logl, long double, (long double x));
775 # endif
776 _GL_CXXALIAS_SYS (logl, long double, (long double x));
777 _GL_CXXALIASWARN (logl);
778 #elif defined GNULIB_POSIXCHECK
779 # undef logl
780 # if HAVE_RAW_DECL_LOGL
781 _GL_WARN_ON_USE (logl, "logl is unportable - "
782                  "use gnulib module mathl for portability");
783 # endif
784 #endif
785
786
787 #if @GNULIB_LOG10F@
788 # if !@HAVE_LOG10F@
789 #  undef log10f
790 _GL_FUNCDECL_SYS (log10f, float, (float x));
791 # endif
792 _GL_CXXALIAS_SYS (log10f, float, (float x));
793 _GL_CXXALIASWARN (log10f);
794 #elif defined GNULIB_POSIXCHECK
795 # undef log10f
796 # if HAVE_RAW_DECL_LOG10F
797 _GL_WARN_ON_USE (log10f, "log10f is unportable - "
798                  "use gnulib module log10f for portability");
799 # endif
800 #endif
801
802
803 #if @GNULIB_MODFF@
804 # if !@HAVE_MODFF@
805 #  undef modff
806 _GL_FUNCDECL_SYS (modff, float, (float x, float *iptr) _GL_ARG_NONNULL ((2)));
807 # endif
808 _GL_CXXALIAS_SYS (modff, float, (float x, float *iptr));
809 _GL_CXXALIASWARN (modff);
810 #elif defined GNULIB_POSIXCHECK
811 # undef modff
812 # if HAVE_RAW_DECL_MODFF
813 _GL_WARN_ON_USE (modff, "modff is unportable - "
814                  "use gnulib module modff for portability");
815 # endif
816 #endif
817
818
819 #if @GNULIB_POWF@
820 # if !@HAVE_POWF@
821 #  undef powf
822 _GL_FUNCDECL_SYS (powf, float, (float x, float y));
823 # endif
824 _GL_CXXALIAS_SYS (powf, float, (float x, float y));
825 _GL_CXXALIASWARN (powf);
826 #elif defined GNULIB_POSIXCHECK
827 # undef powf
828 # if HAVE_RAW_DECL_POWF
829 _GL_WARN_ON_USE (powf, "powf is unportable - "
830                  "use gnulib module powf for portability");
831 # endif
832 #endif
833
834
835 #if @GNULIB_RINTF@
836 # if !@HAVE_RINTF@
837 _GL_FUNCDECL_SYS (rintf, float, (float x));
838 # endif
839 _GL_CXXALIAS_SYS (rintf, float, (float x));
840 _GL_CXXALIASWARN (rintf);
841 #elif defined GNULIB_POSIXCHECK
842 # undef rintf
843 # if HAVE_RAW_DECL_RINTF
844 _GL_WARN_ON_USE (rintf, "rintf is unportable - "
845                  "use gnulib module rintf for portability");
846 # endif
847 #endif
848
849 #if @GNULIB_RINT@
850 # if !@HAVE_RINT@
851 _GL_FUNCDECL_SYS (rint, double, (double x));
852 # endif
853 _GL_CXXALIAS_SYS (rint, double, (double x));
854 _GL_CXXALIASWARN (rint);
855 #elif defined GNULIB_POSIXCHECK
856 # undef rint
857 # if HAVE_RAW_DECL_RINT
858 _GL_WARN_ON_USE (rint, "rint is unportable - "
859                  "use gnulib module rint for portability");
860 # endif
861 #endif
862
863 #if @GNULIB_RINTL@
864 # if !@HAVE_RINTL@
865 _GL_FUNCDECL_SYS (rintl, long double, (long double x));
866 # endif
867 _GL_CXXALIAS_SYS (rintl, long double, (long double x));
868 _GL_CXXALIASWARN (rintl);
869 #elif defined GNULIB_POSIXCHECK
870 # undef rintl
871 # if HAVE_RAW_DECL_RINTL
872 _GL_WARN_ON_USE (rintl, "rintl is unportable - "
873                  "use gnulib module rintl for portability");
874 # endif
875 #endif
876
877
878 #if @GNULIB_ROUNDF@
879 # if @REPLACE_ROUNDF@
880 #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
881 #   undef roundf
882 #   define roundf rpl_roundf
883 #  endif
884 _GL_FUNCDECL_RPL (roundf, float, (float x));
885 _GL_CXXALIAS_RPL (roundf, float, (float x));
886 # else
887 #  if !@HAVE_DECL_ROUNDF@
888 _GL_FUNCDECL_SYS (roundf, float, (float x));
889 #  endif
890 _GL_CXXALIAS_SYS (roundf, float, (float x));
891 # endif
892 _GL_CXXALIASWARN (roundf);
893 #elif defined GNULIB_POSIXCHECK
894 # undef roundf
895 # if HAVE_RAW_DECL_ROUNDF
896 _GL_WARN_ON_USE (roundf, "roundf is unportable - "
897                  "use gnulib module roundf for portability");
898 # endif
899 #endif
900
901 #if @GNULIB_ROUND@
902 # if @REPLACE_ROUND@
903 #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
904 #   undef round
905 #   define round rpl_round
906 #  endif
907 _GL_FUNCDECL_RPL (round, double, (double x));
908 _GL_CXXALIAS_RPL (round, double, (double x));
909 # else
910 #  if !@HAVE_DECL_ROUND@
911 _GL_FUNCDECL_SYS (round, double, (double x));
912 #  endif
913 _GL_CXXALIAS_SYS (round, double, (double x));
914 # endif
915 _GL_CXXALIASWARN (round);
916 #elif defined GNULIB_POSIXCHECK
917 # undef round
918 # if HAVE_RAW_DECL_ROUND
919 _GL_WARN_ON_USE (round, "round is unportable - "
920                  "use gnulib module round for portability");
921 # endif
922 #endif
923
924 #if @GNULIB_ROUNDL@
925 # if @REPLACE_ROUNDL@
926 #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
927 #   undef roundl
928 #   define roundl rpl_roundl
929 #  endif
930 _GL_FUNCDECL_RPL (roundl, long double, (long double x));
931 _GL_CXXALIAS_RPL (roundl, long double, (long double x));
932 # else
933 #  if !@HAVE_DECL_ROUNDL@
934 _GL_FUNCDECL_SYS (roundl, long double, (long double x));
935 #  endif
936 _GL_CXXALIAS_SYS (roundl, long double, (long double x));
937 # endif
938 _GL_CXXALIASWARN (roundl);
939 #elif defined GNULIB_POSIXCHECK
940 # undef roundl
941 # if HAVE_RAW_DECL_ROUNDL
942 _GL_WARN_ON_USE (roundl, "roundl is unportable - "
943                  "use gnulib module roundl for portability");
944 # endif
945 #endif
946
947
948 #if @GNULIB_SINF@
949 # if !@HAVE_SINF@
950 #  undef sinf
951 _GL_FUNCDECL_SYS (sinf, float, (float x));
952 # endif
953 _GL_CXXALIAS_SYS (sinf, float, (float x));
954 _GL_CXXALIASWARN (sinf);
955 #elif defined GNULIB_POSIXCHECK
956 # undef sinf
957 # if HAVE_RAW_DECL_SINF
958 _GL_WARN_ON_USE (sinf, "sinf is unportable - "
959                  "use gnulib module sinf for portability");
960 # endif
961 #endif
962
963 #if @GNULIB_SINL@
964 # if !@HAVE_SINL@ || !@HAVE_DECL_SINL@
965 #  undef sinl
966 _GL_FUNCDECL_SYS (sinl, long double, (long double x));
967 # endif
968 _GL_CXXALIAS_SYS (sinl, long double, (long double x));
969 _GL_CXXALIASWARN (sinl);
970 #elif defined GNULIB_POSIXCHECK
971 # undef sinl
972 # if HAVE_RAW_DECL_SINL
973 _GL_WARN_ON_USE (sinl, "sinl is unportable - "
974                  "use gnulib module mathl for portability");
975 # endif
976 #endif
977
978
979 #if @GNULIB_SINHF@
980 # if !@HAVE_SINHF@
981 #  undef sinhf
982 _GL_FUNCDECL_SYS (sinhf, float, (float x));
983 # endif
984 _GL_CXXALIAS_SYS (sinhf, float, (float x));
985 _GL_CXXALIASWARN (sinhf);
986 #elif defined GNULIB_POSIXCHECK
987 # undef sinhf
988 # if HAVE_RAW_DECL_SINHF
989 _GL_WARN_ON_USE (sinhf, "sinhf is unportable - "
990                  "use gnulib module sinhf for portability");
991 # endif
992 #endif
993
994
995 #if @GNULIB_SQRTF@
996 # if !@HAVE_SQRTF@
997 #  undef sqrtf
998 _GL_FUNCDECL_SYS (sqrtf, float, (float x));
999 # endif
1000 _GL_CXXALIAS_SYS (sqrtf, float, (float x));
1001 _GL_CXXALIASWARN (sqrtf);
1002 #elif defined GNULIB_POSIXCHECK
1003 # undef sqrtf
1004 # if HAVE_RAW_DECL_SQRTF
1005 _GL_WARN_ON_USE (sqrtf, "sqrtf is unportable - "
1006                  "use gnulib module sqrtf for portability");
1007 # endif
1008 #endif
1009
1010 #if @GNULIB_SQRTL@
1011 # if !@HAVE_SQRTL@ || !@HAVE_DECL_SQRTL@
1012 #  undef sqrtl
1013 _GL_FUNCDECL_SYS (sqrtl, long double, (long double x));
1014 # endif
1015 _GL_CXXALIAS_SYS (sqrtl, long double, (long double x));
1016 _GL_CXXALIASWARN (sqrtl);
1017 #elif defined GNULIB_POSIXCHECK
1018 # undef sqrtl
1019 # if HAVE_RAW_DECL_SQRTL
1020 _GL_WARN_ON_USE (sqrtl, "sqrtl is unportable - "
1021                  "use gnulib module mathl for portability");
1022 # endif
1023 #endif
1024
1025
1026 #if @GNULIB_TANF@
1027 # if !@HAVE_TANF@
1028 #  undef tanf
1029 _GL_FUNCDECL_SYS (tanf, float, (float x));
1030 # endif
1031 _GL_CXXALIAS_SYS (tanf, float, (float x));
1032 _GL_CXXALIASWARN (tanf);
1033 #elif defined GNULIB_POSIXCHECK
1034 # undef tanf
1035 # if HAVE_RAW_DECL_TANF
1036 _GL_WARN_ON_USE (tanf, "tanf is unportable - "
1037                  "use gnulib module tanf for portability");
1038 # endif
1039 #endif
1040
1041 #if @GNULIB_TANL@
1042 # if !@HAVE_TANL@ || !@HAVE_DECL_TANL@
1043 #  undef tanl
1044 _GL_FUNCDECL_SYS (tanl, long double, (long double x));
1045 # endif
1046 _GL_CXXALIAS_SYS (tanl, long double, (long double x));
1047 _GL_CXXALIASWARN (tanl);
1048 #elif defined GNULIB_POSIXCHECK
1049 # undef tanl
1050 # if HAVE_RAW_DECL_TANL
1051 _GL_WARN_ON_USE (tanl, "tanl is unportable - "
1052                  "use gnulib module mathl for portability");
1053 # endif
1054 #endif
1055
1056
1057 #if @GNULIB_TANHF@
1058 # if !@HAVE_TANHF@
1059 #  undef tanhf
1060 _GL_FUNCDECL_SYS (tanhf, float, (float x));
1061 # endif
1062 _GL_CXXALIAS_SYS (tanhf, float, (float x));
1063 _GL_CXXALIASWARN (tanhf);
1064 #elif defined GNULIB_POSIXCHECK
1065 # undef tanhf
1066 # if HAVE_RAW_DECL_TANHF
1067 _GL_WARN_ON_USE (tanhf, "tanhf is unportable - "
1068                  "use gnulib module tanhf for portability");
1069 # endif
1070 #endif
1071
1072
1073 #if @GNULIB_TRUNCF@
1074 # if @REPLACE_TRUNCF@
1075 #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1076 #   define truncf rpl_truncf
1077 #  endif
1078 _GL_FUNCDECL_RPL (truncf, float, (float x));
1079 _GL_CXXALIAS_RPL (truncf, float, (float x));
1080 # else
1081 #  if !@HAVE_DECL_TRUNCF@
1082 _GL_FUNCDECL_SYS (truncf, float, (float x));
1083 #  endif
1084 _GL_CXXALIAS_SYS (truncf, float, (float x));
1085 # endif
1086 _GL_CXXALIASWARN (truncf);
1087 #elif defined GNULIB_POSIXCHECK
1088 # undef truncf
1089 # if HAVE_RAW_DECL_TRUNCF
1090 _GL_WARN_ON_USE (truncf, "truncf is unportable - "
1091                  "use gnulib module truncf for portability");
1092 # endif
1093 #endif
1094
1095 #if @GNULIB_TRUNC@
1096 # if @REPLACE_TRUNC@
1097 #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1098 #   define trunc rpl_trunc
1099 #  endif
1100 _GL_FUNCDECL_RPL (trunc, double, (double x));
1101 _GL_CXXALIAS_RPL (trunc, double, (double x));
1102 # else
1103 #  if !@HAVE_DECL_TRUNC@
1104 _GL_FUNCDECL_SYS (trunc, double, (double x));
1105 #  endif
1106 _GL_CXXALIAS_SYS (trunc, double, (double x));
1107 # endif
1108 _GL_CXXALIASWARN (trunc);
1109 #elif defined GNULIB_POSIXCHECK
1110 # undef trunc
1111 # if HAVE_RAW_DECL_TRUNC
1112 _GL_WARN_ON_USE (trunc, "trunc is unportable - "
1113                  "use gnulib module trunc for portability");
1114 # endif
1115 #endif
1116
1117 #if @GNULIB_TRUNCL@
1118 # if @REPLACE_TRUNCL@
1119 #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
1120 #   undef truncl
1121 #   define truncl rpl_truncl
1122 #  endif
1123 _GL_FUNCDECL_RPL (truncl, long double, (long double x));
1124 _GL_CXXALIAS_RPL (truncl, long double, (long double x));
1125 # else
1126 #  if !@HAVE_DECL_TRUNCL@
1127 _GL_FUNCDECL_SYS (truncl, long double, (long double x));
1128 #  endif
1129 _GL_CXXALIAS_SYS (truncl, long double, (long double x));
1130 # endif
1131 _GL_CXXALIASWARN (truncl);
1132 #elif defined GNULIB_POSIXCHECK
1133 # undef truncl
1134 # if HAVE_RAW_DECL_TRUNCL
1135 _GL_WARN_ON_USE (truncl, "truncl is unportable - "
1136                  "use gnulib module truncl for portability");
1137 # endif
1138 #endif
1139
1140
1141 /* Definitions of function-like macros come here, after the function
1142    declarations.  */
1143
1144
1145 #if @GNULIB_ISFINITE@
1146 # if @REPLACE_ISFINITE@
1147 _GL_EXTERN_C int gl_isfinitef (float x);
1148 _GL_EXTERN_C int gl_isfinited (double x);
1149 _GL_EXTERN_C int gl_isfinitel (long double x);
1150 #  undef isfinite
1151 #  define isfinite(x) \
1152    (sizeof (x) == sizeof (long double) ? gl_isfinitel (x) : \
1153     sizeof (x) == sizeof (double) ? gl_isfinited (x) : \
1154     gl_isfinitef (x))
1155 # endif
1156 # ifdef __cplusplus
1157 #  ifdef isfinite
1158 _GL_MATH_CXX_REAL_FLOATING_DECL_1 (isfinite)
1159 #   undef isfinite
1160 _GL_MATH_CXX_REAL_FLOATING_DECL_2 (isfinite)
1161 #  endif
1162 # endif
1163 #elif defined GNULIB_POSIXCHECK
1164 # if defined isfinite
1165 _GL_WARN_REAL_FLOATING_DECL (isfinite);
1166 #  undef isfinite
1167 #  define isfinite(x) _GL_WARN_REAL_FLOATING_IMPL (isfinite, x)
1168 # endif
1169 #endif
1170
1171
1172 #if @GNULIB_ISINF@
1173 # if @REPLACE_ISINF@
1174 _GL_EXTERN_C int gl_isinff (float x);
1175 _GL_EXTERN_C int gl_isinfd (double x);
1176 _GL_EXTERN_C int gl_isinfl (long double x);
1177 #  undef isinf
1178 #  define isinf(x) \
1179    (sizeof (x) == sizeof (long double) ? gl_isinfl (x) : \
1180     sizeof (x) == sizeof (double) ? gl_isinfd (x) : \
1181     gl_isinff (x))
1182 # endif
1183 # ifdef __cplusplus
1184 #  ifdef isinf
1185 _GL_MATH_CXX_REAL_FLOATING_DECL_1 (isinf)
1186 #   undef isinf
1187 _GL_MATH_CXX_REAL_FLOATING_DECL_2 (isinf)
1188 #  endif
1189 # endif
1190 #elif defined GNULIB_POSIXCHECK
1191 # if defined isinf
1192 _GL_WARN_REAL_FLOATING_DECL (isinf);
1193 #  undef isinf
1194 #  define isinf(x) _GL_WARN_REAL_FLOATING_IMPL (isinf, x)
1195 # endif
1196 #endif
1197
1198
1199 #if @GNULIB_ISNANF@
1200 /* Test for NaN for 'float' numbers.  */
1201 # if @HAVE_ISNANF@
1202 /* The original <math.h> included above provides a declaration of isnan macro
1203    or (older) isnanf function.  */
1204 #  if __GNUC__ >= 4
1205     /* GCC 4.0 and newer provides three built-ins for isnan.  */
1206 #   undef isnanf
1207 #   define isnanf(x) __builtin_isnanf ((float)(x))
1208 #  elif defined isnan
1209 #   undef isnanf
1210 #   define isnanf(x) isnan ((float)(x))
1211 #  endif
1212 # else
1213 /* Test whether X is a NaN.  */
1214 #  undef isnanf
1215 #  define isnanf rpl_isnanf
1216 _GL_EXTERN_C int isnanf (float x);
1217 # endif
1218 #endif
1219
1220 #if @GNULIB_ISNAND@
1221 /* Test for NaN for 'double' numbers.
1222    This function is a gnulib extension, unlike isnan() which applied only
1223    to 'double' numbers earlier but now is a type-generic macro.  */
1224 # if @HAVE_ISNAND@
1225 /* The original <math.h> included above provides a declaration of isnan
1226    macro.  */
1227 #  if __GNUC__ >= 4
1228     /* GCC 4.0 and newer provides three built-ins for isnan.  */
1229 #   undef isnand
1230 #   define isnand(x) __builtin_isnan ((double)(x))
1231 #  else
1232 #   undef isnand
1233 #   define isnand(x) isnan ((double)(x))
1234 #  endif
1235 # else
1236 /* Test whether X is a NaN.  */
1237 #  undef isnand
1238 #  define isnand rpl_isnand
1239 _GL_EXTERN_C int isnand (double x);
1240 # endif
1241 #endif
1242
1243 #if @GNULIB_ISNANL@
1244 /* Test for NaN for 'long double' numbers.  */
1245 # if @HAVE_ISNANL@
1246 /* The original <math.h> included above provides a declaration of isnan
1247    macro or (older) isnanl function.  */
1248 #  if __GNUC__ >= 4
1249     /* GCC 4.0 and newer provides three built-ins for isnan.  */
1250 #   undef isnanl
1251 #   define isnanl(x) __builtin_isnanl ((long double)(x))
1252 #  elif defined isnan
1253 #   undef isnanl
1254 #   define isnanl(x) isnan ((long double)(x))
1255 #  endif
1256 # else
1257 /* Test whether X is a NaN.  */
1258 #  undef isnanl
1259 #  define isnanl rpl_isnanl
1260 _GL_EXTERN_C int isnanl (long double x) _GL_ATTRIBUTE_CONST;
1261 # endif
1262 #endif
1263
1264 /* This must come *after* the snippets for GNULIB_ISNANF and GNULIB_ISNANL!  */
1265 #if @GNULIB_ISNAN@
1266 # if @REPLACE_ISNAN@
1267 /* We can't just use the isnanf macro (e.g.) as exposed by
1268    isnanf.h (e.g.) here, because those may end up being macros
1269    that recursively expand back to isnan.  So use the gnulib
1270    replacements for them directly. */
1271 #  if @HAVE_ISNANF@ && __GNUC__ >= 4
1272 #   define gl_isnan_f(x) __builtin_isnanf ((float)(x))
1273 #  else
1274 _GL_EXTERN_C int rpl_isnanf (float x);
1275 #   define gl_isnan_f(x) rpl_isnanf (x)
1276 #  endif
1277 #  if @HAVE_ISNAND@ && __GNUC__ >= 4
1278 #   define gl_isnan_d(x) __builtin_isnan ((double)(x))
1279 #  else
1280 _GL_EXTERN_C int rpl_isnand (double x);
1281 #   define gl_isnan_d(x) rpl_isnand (x)
1282 #  endif
1283 #  if @HAVE_ISNANL@ && __GNUC__ >= 4
1284 #   define gl_isnan_l(x) __builtin_isnanl ((long double)(x))
1285 #  else
1286 _GL_EXTERN_C int rpl_isnanl (long double x) _GL_ATTRIBUTE_CONST;
1287 #   define gl_isnan_l(x) rpl_isnanl (x)
1288 #  endif
1289 #  undef isnan
1290 #  define isnan(x) \
1291    (sizeof (x) == sizeof (long double) ? gl_isnan_l (x) : \
1292     sizeof (x) == sizeof (double) ? gl_isnan_d (x) : \
1293     gl_isnan_f (x))
1294 # elif __GNUC__ >= 4
1295 #  undef isnan
1296 #  define isnan(x) \
1297    (sizeof (x) == sizeof (long double) ? __builtin_isnanl ((long double)(x)) : \
1298     sizeof (x) == sizeof (double) ? __builtin_isnan ((double)(x)) : \
1299     __builtin_isnanf ((float)(x)))
1300 # endif
1301 # ifdef __cplusplus
1302 #  ifdef isnan
1303 _GL_MATH_CXX_REAL_FLOATING_DECL_1 (isnan)
1304 #   undef isnan
1305 _GL_MATH_CXX_REAL_FLOATING_DECL_2 (isnan)
1306 #  endif
1307 # else
1308 /* Ensure isnan is a macro.  */
1309 #  ifndef isnan
1310 #   define isnan isnan
1311 #  endif
1312 # endif
1313 #elif defined GNULIB_POSIXCHECK
1314 # if defined isnan
1315 _GL_WARN_REAL_FLOATING_DECL (isnan);
1316 #  undef isnan
1317 #  define isnan(x) _GL_WARN_REAL_FLOATING_IMPL (isnan, x)
1318 # endif
1319 #endif
1320
1321
1322 #if @GNULIB_SIGNBIT@
1323 # if @REPLACE_SIGNBIT_USING_GCC@
1324 #  undef signbit
1325    /* GCC 4.0 and newer provides three built-ins for signbit.  */
1326 #  define signbit(x) \
1327    (sizeof (x) == sizeof (long double) ? __builtin_signbitl (x) : \
1328     sizeof (x) == sizeof (double) ? __builtin_signbit (x) : \
1329     __builtin_signbitf (x))
1330 # endif
1331 # if @REPLACE_SIGNBIT@
1332 #  undef signbit
1333 _GL_EXTERN_C int gl_signbitf (float arg);
1334 _GL_EXTERN_C int gl_signbitd (double arg);
1335 _GL_EXTERN_C int gl_signbitl (long double arg);
1336 #  if __GNUC__ >= 2 && !defined __STRICT_ANSI__
1337 #   define _GL_NUM_UINT_WORDS(type) \
1338       ((sizeof (type) + sizeof (unsigned int) - 1) / sizeof (unsigned int))
1339 #   if defined FLT_SIGNBIT_WORD && defined FLT_SIGNBIT_BIT && !defined gl_signbitf
1340 #    define gl_signbitf_OPTIMIZED_MACRO
1341 #    define gl_signbitf(arg) \
1342        ({ union { float _value;                                         \
1343                   unsigned int _word[_GL_NUM_UINT_WORDS (float)];       \
1344                 } _m;                                                   \
1345           _m._value = (arg);                                            \
1346           (_m._word[FLT_SIGNBIT_WORD] >> FLT_SIGNBIT_BIT) & 1;          \
1347         })
1348 #   endif
1349 #   if defined DBL_SIGNBIT_WORD && defined DBL_SIGNBIT_BIT && !defined gl_signbitd
1350 #    define gl_signbitd_OPTIMIZED_MACRO
1351 #    define gl_signbitd(arg) \
1352        ({ union { double _value;                                        \
1353                   unsigned int _word[_GL_NUM_UINT_WORDS (double)];      \
1354                 } _m;                                                   \
1355           _m._value = (arg);                                            \
1356           (_m._word[DBL_SIGNBIT_WORD] >> DBL_SIGNBIT_BIT) & 1;          \
1357         })
1358 #   endif
1359 #   if defined LDBL_SIGNBIT_WORD && defined LDBL_SIGNBIT_BIT && !defined gl_signbitl
1360 #    define gl_signbitl_OPTIMIZED_MACRO
1361 #    define gl_signbitl(arg) \
1362        ({ union { long double _value;                                   \
1363                   unsigned int _word[_GL_NUM_UINT_WORDS (long double)]; \
1364                 } _m;                                                   \
1365           _m._value = (arg);                                            \
1366           (_m._word[LDBL_SIGNBIT_WORD] >> LDBL_SIGNBIT_BIT) & 1;        \
1367         })
1368 #   endif
1369 #  endif
1370 #  define signbit(x) \
1371    (sizeof (x) == sizeof (long double) ? gl_signbitl (x) : \
1372     sizeof (x) == sizeof (double) ? gl_signbitd (x) : \
1373     gl_signbitf (x))
1374 # endif
1375 # ifdef __cplusplus
1376 #  ifdef signbit
1377 _GL_MATH_CXX_REAL_FLOATING_DECL_1 (signbit)
1378 #   undef signbit
1379 _GL_MATH_CXX_REAL_FLOATING_DECL_2 (signbit)
1380 #  endif
1381 # endif
1382 #elif defined GNULIB_POSIXCHECK
1383 # if defined signbit
1384 _GL_WARN_REAL_FLOATING_DECL (signbit);
1385 #  undef signbit
1386 #  define signbit(x) _GL_WARN_REAL_FLOATING_IMPL (signbit, x)
1387 # endif
1388 #endif
1389
1390
1391 #endif /* _@GUARD_PREFIX@_MATH_H */
1392 #endif /* _@GUARD_PREFIX@_MATH_H */