avoid unnecessary newline
[gnutls.git] / gl / tests / nan.h
blob2f75da1574cb9e7036bfb0a68bb0e81b5903acda
1 /* Macros for not-a-number.
2 Copyright (C) 2007-2012 Free Software Foundation, Inc.
4 This program is free software: you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by
6 the Free Software Foundation; either version 3 of the License, or
7 (at your option) any later version.
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
14 You should have received a copy of the GNU General Public License
15 along with this program. If not, see <http://www.gnu.org/licenses/>. */
18 /* NaNf () returns a 'float' not-a-number. */
20 /* The Compaq (ex-DEC) C 6.4 compiler and the Microsoft MSVC 9 compiler choke
21 on the expression 0.0 / 0.0. */
22 #if defined __DECC || defined _MSC_VER
23 static float
24 NaNf ()
26 static float zero = 0.0f;
27 return zero / zero;
29 #else
30 # define NaNf() (0.0f / 0.0f)
31 #endif
34 /* NaNd () returns a 'double' not-a-number. */
36 /* The Compaq (ex-DEC) C 6.4 compiler and the Microsoft MSVC 9 compiler choke
37 on the expression 0.0 / 0.0. */
38 #if defined __DECC || defined _MSC_VER
39 static double
40 NaNd ()
42 static double zero = 0.0;
43 return zero / zero;
45 #else
46 # define NaNd() (0.0 / 0.0)
47 #endif
50 /* NaNl () returns a 'long double' not-a-number. */
52 /* On Irix 6.5, gcc 3.4.3 can't compute compile-time NaN, and needs the
53 runtime type conversion.
54 The Microsoft MSVC 9 compiler chokes on the expression 0.0L / 0.0L. */
55 #ifdef __sgi
56 static long double NaNl ()
58 double zero = 0.0;
59 return zero / zero;
61 #elif defined _MSC_VER
62 static long double
63 NaNl ()
65 static long double zero = 0.0L;
66 return zero / zero;
68 #else
69 # define NaNl() (0.0L / 0.0L)
70 #endif