initial import
[glibc.git] / sysdeps / ieee754 / nan.h
blobe34c172dcbbf2897cf14bd1a6e10239fbd55004e
1 /* `NAN' constant for IEEE 754 machines.
3 Copyright (C) 1992 Free Software Foundation, Inc.
4 This file is part of the GNU C Library.
6 The GNU C Library is free software; you can redistribute it and/or
7 modify it under the terms of the GNU Library General Public License as
8 published by the Free Software Foundation; either version 2 of the
9 License, or (at your option) any later version.
11 The GNU C Library is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 Library General Public License for more details.
16 You should have received a copy of the GNU Library General Public
17 License along with the GNU C Library; see the file COPYING.LIB. If
18 not, write to the Free Software Foundation, Inc., 675 Mass Ave,
19 Cambridge, MA 02139, USA. */
21 #ifndef _NAN_H
23 #define _NAN_H 1
25 /* IEEE Not A Number. */
27 #include <endian.h>
29 #if __BYTE_ORDER == __BIG_ENDIAN
30 #define __nan_bytes { 0x7f, 0xf8, 0, 0, 0, 0, 0, 0 }
31 #endif
32 #if __BYTE_ORDER == __LITTLE_ENDIAN
33 #define __nan_bytes { 0, 0, 0, 0, 0, 0, 0xf8, 0x7f }
34 #endif
36 #ifdef __GNUC__
37 #define NAN \
38 (__extension__ ((union { unsigned char __c[8]; \
39 double __d; }) \
40 { __nan_bytes }).__d)
41 #else /* Not GCC. */
42 static CONST char __nan[8] = __nan_bytes;
43 #define NAN (*(CONST double *) __nan)
44 #endif /* GCC. */
46 #endif /* nan.h */