Back to index

glibc  2.9
s_isnan.c
Go to the documentation of this file.
00001 /* Return 1 if argument is a NaN, else 0.
00002    Copyright (C) 2007 Free Software Foundation, Inc.
00003    This file is part of the GNU C Library.
00004 
00005    The GNU C Library is free software; you can redistribute it and/or
00006    modify it under the terms of the GNU Lesser General Public
00007    License as published by the Free Software Foundation; either
00008    version 2.1 of the License, or (at your option) any later version.
00009 
00010    The GNU C Library is distributed in the hope that it will be useful,
00011    but WITHOUT ANY WARRANTY; without even the implied warranty of
00012    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00013    Lesser General Public License for more details.
00014 
00015    You should have received a copy of the GNU Lesser General Public
00016    License along with the GNU C Library; if not, write to the Free
00017    Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
00018    02111-1307 USA.  */
00019 
00020 /* Ugly kludge to avoid declarations.  */
00021 #define __isnanf     not___isnanf
00022 #define isnanf              not_isnanf
00023 #define __GI___isnanf       not__GI___isnanf
00024 
00025 #include <math.h>
00026 #include <math_ldbl_opt.h>
00027 
00028 #undef __isnanf
00029 #undef isnanf
00030 #undef __GI___isnanf
00031 
00032 /* The hidden_proto in include/math.h was obscured by the macro hackery.  */
00033 __typeof (__isnan) __isnanf;
00034 hidden_proto (__isnanf)
00035 
00036 
00037 int
00038 __isnan (double x)
00039 {
00040   return isunordered (x, x);
00041 }
00042 
00043 hidden_def (__isnan)
00044 weak_alias (__isnan, isnan)
00045 
00046 /* It turns out that the 'double' version will also always work for
00047    single-precision.  */
00048 strong_alias (__isnan, __isnanf)
00049 hidden_def (__isnanf)
00050 weak_alias (__isnanf, isnanf)
00051 
00052 #ifdef NO_LONG_DOUBLE
00053 strong_alias (__isnan, __isnanl)
00054 weak_alias (__isnan, isnanl)
00055 #endif
00056 #if LONG_DOUBLE_COMPAT(libc, GLIBC_2_0)
00057 compat_symbol (libc, __isnan, __isnanl, GLIBC_2_0);
00058 compat_symbol (libc, isnan, isnanl, GLIBC_2_0);
00059 #endif