update from main archive 961114
[glibc.git] / sysdeps / ieee754 / nan.h
blobbea98d96d4fb492efa0352708f302d056713752c
1 /* `NAN' constant for IEEE 754 machines.
2 Copyright (C) 1992, 1996 Free Software Foundation, Inc.
3 This file is part of the GNU C Library.
5 The GNU C Library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Library General Public License as
7 published by the Free Software Foundation; either version 2 of the
8 License, or (at your option) any later version.
10 The GNU C Library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Library General Public License for more details.
15 You should have received a copy of the GNU Library General Public
16 License along with the GNU C Library; see the file COPYING.LIB. If not,
17 write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
18 Boston, MA 02111-1307, USA. */
20 #ifndef _NAN_H
22 #define _NAN_H 1
24 /* IEEE Not A Number. */
26 #include <endian.h>
28 #if __BYTE_ORDER == __BIG_ENDIAN
29 #define __nan_bytes { 0x7f, 0xf8, 0, 0, 0, 0, 0, 0 }
30 #endif
31 #if __BYTE_ORDER == __LITTLE_ENDIAN
32 #define __nan_bytes { 0, 0, 0, 0, 0, 0, 0xf8, 0x7f }
33 #endif
35 #ifdef __GNUC__
36 #define NAN \
37 (__extension__ ((union { unsigned char __c[8]; \
38 double __d; }) \
39 { __nan_bytes }).__d)
40 #else /* Not GCC. */
41 static CONST char __nan[8] = __nan_bytes;
42 #define NAN (*(CONST double *) __nan)
43 #endif /* GCC. */
45 #endif /* nan.h */