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