1 /* Macros for quiet not-a-number.
2 Copyright (C) 2023-2024 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 <https://www.gnu.org/licenses/>. */
25 /* Returns a quiet 'float' NaN with sign bit == 0. */
26 _GL_UNUSED
static float
29 /* 'volatile' works around a GCC bug:
30 <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111655> */
31 float volatile nan
= NaNf ();
32 return (signbit (nan
) ? - nan
: nan
);
35 /* Returns a quiet 'float' NaN with sign bit == 1. */
36 _GL_UNUSED
static float
39 /* 'volatile' works around a GCC bug:
40 <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111655> */
41 float volatile nan
= NaNf ();
42 return (signbit (nan
) ? nan
: - nan
);
46 /* Returns a quiet 'double' NaN with sign bit == 0. */
47 _GL_UNUSED
static double
50 /* 'volatile' works around a GCC bug:
51 <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111655> */
52 double volatile nan
= NaNd ();
53 return (signbit (nan
) ? - nan
: nan
);
56 /* Returns a quiet 'double' NaN with sign bit == 1. */
57 _GL_UNUSED
static double
60 /* 'volatile' works around a GCC bug:
61 <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111655> */
62 double volatile nan
= NaNd ();
63 return (signbit (nan
) ? nan
: - nan
);
67 /* Returns a quiet 'long double' NaN with sign bit == 0. */
68 _GL_UNUSED
static long double
71 /* 'volatile' works around a GCC bug:
72 <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111655> */
73 long double volatile nan
= NaNl ();
74 return (signbit (nan
) ? - nan
: nan
);
77 /* Returns a quiet 'long double' NaN with sign bit == 1. */
78 _GL_UNUSED
static long double
81 /* 'volatile' works around a GCC bug:
82 <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111655> */
83 long double volatile nan
= NaNl ();
84 return (signbit (nan
) ? nan
: - nan
);
88 #endif /* _SIGNED_NAN_H */