Blame floatmagic.h

Packit 575503
/*
Packit 575503
 * floatmagic.h -- Definitions of isnan and isinf for gawk.
Packit 575503
 */
Packit 575503
Packit 575503
/*
Packit 575503
 * Copyright (C) 2009 the Free Software Foundation, Inc.
Packit 575503
 *
Packit 575503
 * This file is part of GAWK, the GNU implementation of the
Packit 575503
 * AWK Programming Language.
Packit 575503
 *
Packit 575503
 * GAWK is free software; you can redistribute it and/or modify
Packit 575503
 * it under the terms of the GNU General Public License as published by
Packit 575503
 * the Free Software Foundation; either version 3 of the License, or
Packit 575503
 * (at your option) any later version.
Packit 575503
 *
Packit 575503
 * GAWK is distributed in the hope that it will be useful,
Packit 575503
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
Packit 575503
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
Packit 575503
 * GNU General Public License for more details.
Packit 575503
 *
Packit 575503
 * You should have received a copy of the GNU General Public License
Packit 575503
 * along with this program; if not, write to the Free Software
Packit 575503
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA
Packit 575503
 */
Packit 575503
Packit 575503
/*
Packit 575503
 * NOTE: <math.h> MUST be included before this file. Also <config.h>.
Packit 575503
 *
Packit 575503
 * These definitions are taken from the Autoconf 2.63 manual. Not pretty.
Packit 575503
 */
Packit 575503
Packit 575503
#ifndef HAVE_ISNAN
Packit 575503
#ifndef isnan
Packit 575503
# define isnan(x) \
Packit 575503
    (sizeof (x) == sizeof (long double) ? isnan_ld (x) \
Packit 575503
     : sizeof (x) == sizeof (double) ? isnan_d (x) \
Packit 575503
     : isnan_f (x))
Packit 575503
static inline int isnan_f  (float       x) { return x != x; }
Packit 575503
static inline int isnan_d  (double      x) { return x != x; }
Packit 575503
static inline int isnan_ld (long double x) { return x != x; }
Packit 575503
#endif
Packit 575503
#endif
Packit 575503
Packit 575503
#ifndef HAVE_ISINF
Packit 575503
#ifndef isinf
Packit 575503
# define isinf(x) \
Packit 575503
    (sizeof (x) == sizeof (long double) ? isinf_ld (x) \
Packit 575503
     : sizeof (x) == sizeof (double) ? isinf_d (x) \
Packit 575503
     : isinf_f (x))
Packit 575503
static inline int isinf_f  (float       x) { return isnan (x - x); }
Packit 575503
static inline int isinf_d  (double      x) { return isnan (x - x); }
Packit 575503
static inline int isinf_ld (long double x) { return isnan (x - x); }
Packit 575503
#endif
Packit 575503
#endif