comparison lib/math.in.h @ 10667:678640901735

Move the isnanf(), isnand(), isnanl() declarations to <math.h>.
author Bruno Haible <bruno@clisp.org>
date Sun, 19 Oct 2008 14:05:30 +0200
parents 8668b19a7032
children 08a197428e92
comparison
equal deleted inserted replaced
10666:d162e4057aa8 10667:678640901735
399 #elif defined GNULIB_POSIXCHECK 399 #elif defined GNULIB_POSIXCHECK
400 /* How to override a macro? */ 400 /* How to override a macro? */
401 #endif 401 #endif
402 402
403 403
404 #if @GNULIB_ISNANF@
405 /* Test for NaN for 'float' numbers. */
406 # if @HAVE_ISNANF@
407 /* The original <math.h> included above provides a declaration of isnan macro
408 or (older) isnanf function. */
409 # include <math.h>
410 # if __GNUC__ >= 4
411 /* GCC 4.0 and newer provides three built-ins for isnan. */
412 # undef isnanf
413 # define isnanf(x) __builtin_isnanf ((float)(x))
414 # elif defined isnan
415 # undef isnanf
416 # define isnanf(x) isnan ((float)(x))
417 # endif
418 # else
419 /* Test whether X is a NaN. */
420 # undef isnanf
421 # define isnanf rpl_isnanf
422 extern int isnanf (float x);
423 # endif
424 #endif
425
426 #if @GNULIB_ISNAND@
427 /* Test for NaN for 'double' numbers.
428 This function is a gnulib extension, unlike isnan() which applied only
429 to 'double' numbers earlier but now is a type-generic macro. */
430 # if @HAVE_ISNAND@
431 /* The original <math.h> included above provides a declaration of isnan macro. */
432 # include <math.h>
433 # if __GNUC__ >= 4
434 /* GCC 4.0 and newer provides three built-ins for isnan. */
435 # undef isnand
436 # define isnand(x) __builtin_isnan ((double)(x))
437 # else
438 # undef isnand
439 # define isnand(x) isnan ((double)(x))
440 # endif
441 # else
442 /* Test whether X is a NaN. */
443 # undef isnand
444 # define isnand rpl_isnand
445 extern int isnand (double x);
446 # endif
447 #endif
448
449 #if @GNULIB_ISNANL@
450 /* Test for NaN for 'long double' numbers. */
451 # if @HAVE_ISNANL@
452 /* The original <math.h> included above provides a declaration of isnan macro or (older) isnanl function. */
453 # include <math.h>
454 # if __GNUC__ >= 4
455 /* GCC 4.0 and newer provides three built-ins for isnan. */
456 # undef isnanl
457 # define isnanl(x) __builtin_isnanl ((long double)(x))
458 # elif defined isnan
459 # undef isnanl
460 # define isnanl(x) isnan ((long double)(x))
461 # endif
462 # else
463 /* Test whether X is a NaN. */
464 # undef isnanl
465 # define isnanl rpl_isnanl
466 extern int isnanl (long double x);
467 # endif
468 #endif
469
470 /* This must come *after* the snippets for GNULIB_ISNANF and GNULIB_ISNANL! */
404 #if @GNULIB_ISNAN@ 471 #if @GNULIB_ISNAN@
405 # if @REPLACE_ISNAN@ 472 # if @REPLACE_ISNAN@
406 /* We can't just use the isnanf macro (e.g.) as exposed by 473 /* We can't just use the isnanf macro (e.g.) as exposed by
407 isnanf.h (e.g.) here, because those may end up being macros 474 isnanf.h (e.g.) here, because those may end up being macros
408 that recursively expand back to isnan. So use the gnulib 475 that recursively expand back to isnan. So use the gnulib
409 replacements for them directly. */ 476 replacements for them directly. */
410 # if HAVE_ISNANF && __GNUC__ >= 4 477 # if @HAVE_ISNANF@ && __GNUC__ >= 4
411 # define gl_isnan_f(x) __builtin_isnan ((float)(x)) 478 # define gl_isnan_f(x) __builtin_isnan ((float)(x))
412 # else 479 # else
413 extern int rpl_isnanf (float x); 480 extern int rpl_isnanf (float x);
414 # define gl_isnan_f(x) rpl_isnanf (x) 481 # define gl_isnan_f(x) rpl_isnanf (x)
415 # endif 482 # endif
416 # if HAVE_ISNAND && __GNUC__ >= 4 483 # if @HAVE_ISNAND@ && __GNUC__ >= 4
417 # define gl_isnan_d(x) __builtin_isnan ((double)(x)) 484 # define gl_isnan_d(x) __builtin_isnan ((double)(x))
418 # else 485 # else
419 extern int rpl_isnand (double x); 486 extern int rpl_isnand (double x);
420 # define gl_isnan_d(x) rpl_isnand (x) 487 # define gl_isnan_d(x) rpl_isnand (x)
421 # endif 488 # endif
422 # if HAVE_ISNANL && __GNUC__ >= 4 489 # if @HAVE_ISNANL@ && __GNUC__ >= 4
423 # define gl_isnan_l(x) __builtin_isnan ((long double)(x)) 490 # define gl_isnan_l(x) __builtin_isnan ((long double)(x))
424 # else 491 # else
425 extern int rpl_isnanl (long double x); 492 extern int rpl_isnanl (long double x);
426 # define gl_isnan_l(x) rpl_isnanl (x) 493 # define gl_isnan_l(x) rpl_isnanl (x)
427 # endif 494 # endif