1 1.1 christos /* Test for NaN that does not need libm. 2 1.1 christos Copyright (C) 2007-2020 Free Software Foundation, Inc. 3 1.1 christos 4 1.1 christos This program is free software: you can redistribute it and/or modify 5 1.1 christos it under the terms of the GNU General Public License as published by 6 1.1 christos the Free Software Foundation; either version 3 of the License, or 7 1.1 christos (at your option) any later version. 8 1.1 christos 9 1.1 christos This program is distributed in the hope that it will be useful, 10 1.1 christos but WITHOUT ANY WARRANTY; without even the implied warranty of 11 1.1 christos MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 1.1 christos GNU General Public License for more details. 13 1.1 christos 14 1.1 christos You should have received a copy of the GNU General Public License 15 1.1 christos along with this program. If not, see <https://www.gnu.org/licenses/>. */ 16 1.1 christos 17 1.1 christos #if HAVE_ISNANL_IN_LIBC 18 1.1 christos /* Get declaration of isnan macro or (older) isnanl function. */ 19 1.1 christos # include <math.h> 20 1.1 christos # ifndef __has_builtin 21 1.1 christos # define __has_builtin(name) 0 22 1.1 christos # endif 23 1.1 christos # if __GNUC__ >= 4 && (!defined __clang__ || __has_builtin (__builtin_isnanl)) 24 1.1 christos /* GCC 4.0 and newer provides three built-ins for isnan. */ 25 1.1 christos # undef isnanl 26 1.1 christos # define isnanl(x) __builtin_isnanl ((long double)(x)) 27 1.1 christos # elif defined isnan 28 1.1 christos # undef isnanl 29 1.1 christos # define isnanl(x) isnan ((long double)(x)) 30 1.1 christos # endif 31 1.1 christos #else 32 1.1 christos /* Test whether X is a NaN. */ 33 1.1 christos # undef isnanl 34 1.1 christos # define isnanl rpl_isnanl 35 1.1 christos extern int isnanl (long double x); 36 1.1 christos #endif 37