| 1 |
/* Macros for infinity. |
| 2 |
Copyright (C) 2011-2025 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 <https://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 |
The IBM XL C compiler on z/OS complains. |
| 22 |
PGI 16.10 complains. */ |
| 23 |
#if defined _MSC_VER || (defined __MVS__ && defined __IBMC__) || defined __PGI |
| 24 |
static float |
| 25 |
Infinityf () |
| 26 |
{ |
| 27 |
static float zero = 0.0f; |
| 28 |
return 1.0f / zero; |
| 29 |
} |
| 30 |
#else |
| 31 |
# define Infinityf() (1.0f / 0.0f) |
| 32 |
#endif |
| 33 |
|
| 34 |
|
| 35 |
/* Infinityd () returns a 'double' +Infinity. */ |
| 36 |
|
| 37 |
/* The Microsoft MSVC 9 compiler chokes on the expression 1.0 / 0.0. |
| 38 |
The IBM XL C compiler on z/OS complains. |
| 39 |
PGI 16.10 complains. */ |
| 40 |
#if defined _MSC_VER || (defined __MVS__ && defined __IBMC__) || defined __PGI |
| 41 |
static double |
| 42 |
Infinityd () |
| 43 |
{ |
| 44 |
static double zero = 0.0; |
| 45 |
return 1.0 / zero; |
| 46 |
} |
| 47 |
#else |
| 48 |
# define Infinityd() (1.0 / 0.0) |
| 49 |
#endif |
| 50 |
|
| 51 |
|
| 52 |
/* Infinityl () returns a 'long double' +Infinity. */ |
| 53 |
|
| 54 |
/* The Microsoft MSVC 9 compiler chokes on the expression 1.0L / 0.0L. |
| 55 |
The IBM XL C compiler on z/OS complains. |
| 56 |
PGI 16.10 complains. */ |
| 57 |
#if defined _MSC_VER || (defined __MVS__ && defined __IBMC__) || defined __PGI |
| 58 |
static long double |
| 59 |
Infinityl () |
| 60 |
{ |
| 61 |
static long double zero = 0.0L; |
| 62 |
return 1.0L / zero; |
| 63 |
} |
| 64 |
#else |
| 65 |
# define Infinityl() (1.0L / 0.0L) |
| 66 |
#endif |