maint: update copyright
[gnulib.git] / tests / infinity.h
1 /* Macros for infinity.
2    Copyright (C) 2011-2014 Free Software Foundation, Inc.
3
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.
8
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.
13
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/>.  */
16
17
18 /* Infinityf () returns a 'float' +Infinity.  */
19
20 /* The Microsoft MSVC 9 compiler chokes on the expression 1.0f / 0.0f.  */
21 #if defined _MSC_VER
22 static float
23 Infinityf ()
24 {
25   static float zero = 0.0f;
26   return 1.0f / zero;
27 }
28 #else
29 # define Infinityf() (1.0f / 0.0f)
30 #endif
31
32
33 /* Infinityd () returns a 'double' +Infinity.  */
34
35 /* The Microsoft MSVC 9 compiler chokes on the expression 1.0 / 0.0.  */
36 #if defined _MSC_VER
37 static double
38 Infinityd ()
39 {
40   static double zero = 0.0;
41   return 1.0 / zero;
42 }
43 #else
44 # define Infinityd() (1.0 / 0.0)
45 #endif
46
47
48 /* Infinityl () returns a 'long double' +Infinity.  */
49
50 /* The Microsoft MSVC 9 compiler chokes on the expression 1.0L / 0.0L.  */
51 #if defined _MSC_VER
52 static double
53 Infinityl ()
54 {
55   static long double zero = 0.0L;
56   return 1.0L / zero;
57 }
58 #else
59 # define Infinityl() (1.0L / 0.0L)
60 #endif