diff options
Diffstat (limited to 'gl/math.in.h')
-rw-r--r-- | gl/math.in.h | 585 |
1 files changed, 384 insertions, 201 deletions
diff --git a/gl/math.in.h b/gl/math.in.h index a0efefda..fbc29184 100644 --- a/gl/math.in.h +++ b/gl/math.in.h | |||
@@ -1,6 +1,6 @@ | |||
1 | /* A GNU-like <math.h>. | 1 | /* A GNU-like <math.h>. |
2 | 2 | ||
3 | Copyright (C) 2002-2003, 2007-2009 Free Software Foundation, Inc. | 3 | Copyright (C) 2002-2003, 2007-2010 Free Software Foundation, Inc. |
4 | 4 | ||
5 | This program is free software: you can redistribute it and/or modify | 5 | This program is free software: you can redistribute it and/or modify |
6 | it under the terms of the GNU General Public License as published by | 6 | it under the terms of the GNU General Public License as published by |
@@ -22,18 +22,48 @@ | |||
22 | #endif | 22 | #endif |
23 | 23 | ||
24 | /* The include_next requires a split double-inclusion guard. */ | 24 | /* The include_next requires a split double-inclusion guard. */ |
25 | #@INCLUDE_NEXT_AS_FIRST_DIRECTIVE@ @NEXT_MATH_H@ | 25 | #@INCLUDE_NEXT_AS_FIRST_DIRECTIVE@ @NEXT_AS_FIRST_DIRECTIVE_MATH_H@ |
26 | 26 | ||
27 | #ifndef _GL_MATH_H | 27 | #ifndef _GL_MATH_H |
28 | #define _GL_MATH_H | 28 | #define _GL_MATH_H |
29 | 29 | ||
30 | 30 | ||
31 | /* The definition of GL_LINK_WARNING is copied here. */ | 31 | /* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */ |
32 | 32 | ||
33 | 33 | /* The definition of _GL_ARG_NONNULL is copied here. */ | |
34 | #ifdef __cplusplus | 34 | |
35 | extern "C" { | 35 | /* The definition of _GL_WARN_ON_USE is copied here. */ |
36 | #endif | 36 | |
37 | /* Helper macros to define a portability warning for the | ||
38 | classification macro FUNC called with VALUE. POSIX declares the | ||
39 | classification macros with an argument of real-floating (that is, | ||
40 | one of float, double, or long double). */ | ||
41 | #define _GL_WARN_REAL_FLOATING_DECL(func) \ | ||
42 | static inline int \ | ||
43 | rpl_ ## func ## f (float f) \ | ||
44 | { \ | ||
45 | return func (f); \ | ||
46 | } \ | ||
47 | static inline int \ | ||
48 | rpl_ ## func ## d (double d) \ | ||
49 | { \ | ||
50 | return func (d); \ | ||
51 | } \ | ||
52 | static inline int \ | ||
53 | rpl_ ## func ## l (long double l) \ | ||
54 | { \ | ||
55 | return func (l); \ | ||
56 | } \ | ||
57 | _GL_WARN_ON_USE (rpl_ ## func ## f, #func " is unportable - " \ | ||
58 | "use gnulib module " #func " for portability"); \ | ||
59 | _GL_WARN_ON_USE (rpl_ ## func ## d, #func " is unportable - " \ | ||
60 | "use gnulib module " #func " for portability"); \ | ||
61 | _GL_WARN_ON_USE (rpl_ ## func ## l, #func " is unportable - " \ | ||
62 | "use gnulib module " #func " for portability") | ||
63 | #define _GL_WARN_REAL_FLOATING_IMPL(func, value) \ | ||
64 | (sizeof (value) == sizeof (float) ? rpl_ ## func ## f (value) \ | ||
65 | : sizeof (value) == sizeof (double) ? rpl_ ## func ## d (value) \ | ||
66 | : rpl_ ## func ## l (value)) | ||
37 | 67 | ||
38 | 68 | ||
39 | /* POSIX allows platforms that don't support NAN. But all major | 69 | /* POSIX allows platforms that don't support NAN. But all major |
@@ -64,6 +94,7 @@ _NaN () | |||
64 | # define HUGE_VAL (1.0 / 0.0) | 94 | # define HUGE_VAL (1.0 / 0.0) |
65 | #endif | 95 | #endif |
66 | 96 | ||
97 | |||
67 | /* Write x as | 98 | /* Write x as |
68 | x = mantissa * 2^exp | 99 | x = mantissa * 2^exp |
69 | where | 100 | where |
@@ -73,129 +104,198 @@ _NaN () | |||
73 | Store exp in *EXPPTR and return mantissa. */ | 104 | Store exp in *EXPPTR and return mantissa. */ |
74 | #if @GNULIB_FREXP@ | 105 | #if @GNULIB_FREXP@ |
75 | # if @REPLACE_FREXP@ | 106 | # if @REPLACE_FREXP@ |
76 | # define frexp rpl_frexp | 107 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE) |
77 | extern double frexp (double x, int *expptr); | 108 | # define frexp rpl_frexp |
109 | # endif | ||
110 | _GL_FUNCDECL_RPL (frexp, double, (double x, int *expptr) _GL_ARG_NONNULL ((2))); | ||
111 | _GL_CXXALIAS_RPL (frexp, double, (double x, int *expptr)); | ||
112 | # else | ||
113 | _GL_CXXALIAS_SYS (frexp, double, (double x, int *expptr)); | ||
78 | # endif | 114 | # endif |
115 | _GL_CXXALIASWARN (frexp); | ||
79 | #elif defined GNULIB_POSIXCHECK | 116 | #elif defined GNULIB_POSIXCHECK |
80 | # undef frexp | 117 | # undef frexp |
81 | # define frexp(x,e) \ | 118 | /* Assume frexp is always declared. */ |
82 | (GL_LINK_WARNING ("frexp is unportable - " \ | 119 | _GL_WARN_ON_USE (frexp, "frexp is unportable - " |
83 | "use gnulib module frexp for portability"), \ | 120 | "use gnulib module frexp for portability"); |
84 | frexp (x, e)) | ||
85 | #endif | 121 | #endif |
86 | 122 | ||
87 | 123 | ||
88 | #if @GNULIB_MATHL@ || !@HAVE_DECL_ACOSL@ | 124 | #if @GNULIB_LOGB@ |
89 | extern long double acosl (long double x); | 125 | # if !@HAVE_DECL_LOGB@ |
126 | _GL_EXTERN_C double logb (double x); | ||
127 | # endif | ||
128 | #elif defined GNULIB_POSIXCHECK | ||
129 | # undef logb | ||
130 | # if HAVE_RAW_DECL_LOGB | ||
131 | _GL_WARN_ON_USE (logb, "logb is unportable - " | ||
132 | "use gnulib module logb for portability"); | ||
133 | # endif | ||
90 | #endif | 134 | #endif |
91 | #if !@GNULIB_MATHL@ && defined GNULIB_POSIXCHECK | 135 | |
136 | |||
137 | #if @GNULIB_ACOSL@ | ||
138 | # if !@HAVE_ACOSL@ || !@HAVE_DECL_ACOSL@ | ||
139 | _GL_FUNCDECL_SYS (acosl, long double, (long double x)); | ||
140 | # endif | ||
141 | _GL_CXXALIAS_SYS (acosl, long double, (long double x)); | ||
142 | _GL_CXXALIASWARN (acosl); | ||
143 | #elif defined GNULIB_POSIXCHECK | ||
92 | # undef acosl | 144 | # undef acosl |
93 | # define acosl(x) \ | 145 | # if HAVE_RAW_DECL_ACOSL |
94 | (GL_LINK_WARNING ("acosl is unportable - " \ | 146 | _GL_WARN_ON_USE (acosl, "acosl is unportable - " |
95 | "use gnulib module mathl for portability"), \ | 147 | "use gnulib module mathl for portability"); |
96 | acosl (x)) | 148 | # endif |
97 | #endif | 149 | #endif |
98 | 150 | ||
99 | 151 | ||
100 | #if @GNULIB_MATHL@ || !@HAVE_DECL_ASINL@ | 152 | #if @GNULIB_ASINL@ |
101 | extern long double asinl (long double x); | 153 | # if !@HAVE_ASINL@ || !@HAVE_DECL_ASINL@ |
102 | #endif | 154 | _GL_FUNCDECL_SYS (asinl, long double, (long double x)); |
103 | #if !@GNULIB_MATHL@ && defined GNULIB_POSIXCHECK | 155 | # endif |
156 | _GL_CXXALIAS_SYS (asinl, long double, (long double x)); | ||
157 | _GL_CXXALIASWARN (asinl); | ||
158 | #elif defined GNULIB_POSIXCHECK | ||
104 | # undef asinl | 159 | # undef asinl |
105 | # define asinl(x) \ | 160 | # if HAVE_RAW_DECL_ASINL |
106 | (GL_LINK_WARNING ("asinl is unportable - " \ | 161 | _GL_WARN_ON_USE (asinl, "asinl is unportable - " |
107 | "use gnulib module mathl for portability"), \ | 162 | "use gnulib module mathl for portability"); |
108 | asinl (x)) | 163 | # endif |
109 | #endif | 164 | #endif |
110 | 165 | ||
111 | 166 | ||
112 | #if @GNULIB_MATHL@ || !@HAVE_DECL_ATANL@ | 167 | #if @GNULIB_ATANL@ |
113 | extern long double atanl (long double x); | 168 | # if !@HAVE_ATANL@ || !@HAVE_DECL_ATANL@ |
114 | #endif | 169 | _GL_FUNCDECL_SYS (atanl, long double, (long double x)); |
115 | #if !@GNULIB_MATHL@ && defined GNULIB_POSIXCHECK | 170 | # endif |
171 | _GL_CXXALIAS_SYS (atanl, long double, (long double x)); | ||
172 | _GL_CXXALIASWARN (atanl); | ||
173 | #elif defined GNULIB_POSIXCHECK | ||
116 | # undef atanl | 174 | # undef atanl |
117 | # define atanl(x) \ | 175 | # if HAVE_RAW_DECL_ATANL |
118 | (GL_LINK_WARNING ("atanl is unportable - " \ | 176 | _GL_WARN_ON_USE (atanl, "atanl is unportable - " |
119 | "use gnulib module mathl for portability"), \ | 177 | "use gnulib module mathl for portability"); |
120 | atanl (x)) | 178 | # endif |
121 | #endif | 179 | #endif |
122 | 180 | ||
123 | 181 | ||
124 | #if @GNULIB_CEILF@ | 182 | #if @GNULIB_CEILF@ |
125 | # if @REPLACE_CEILF@ | 183 | # if @REPLACE_CEILF@ |
126 | # define ceilf rpl_ceilf | 184 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE) |
127 | extern float ceilf (float x); | 185 | # define ceilf rpl_ceilf |
186 | # endif | ||
187 | _GL_FUNCDECL_RPL (ceilf, float, (float x)); | ||
188 | _GL_CXXALIAS_RPL (ceilf, float, (float x)); | ||
189 | # else | ||
190 | # if !@HAVE_DECL_CEILF@ | ||
191 | _GL_FUNCDECL_SYS (ceilf, float, (float x)); | ||
192 | # endif | ||
193 | _GL_CXXALIAS_SYS (ceilf, float, (float x)); | ||
128 | # endif | 194 | # endif |
195 | _GL_CXXALIASWARN (ceilf); | ||
129 | #elif defined GNULIB_POSIXCHECK | 196 | #elif defined GNULIB_POSIXCHECK |
130 | # undef ceilf | 197 | # undef ceilf |
131 | # define ceilf(x) \ | 198 | # if HAVE_RAW_DECL_CEILF |
132 | (GL_LINK_WARNING ("ceilf is unportable - " \ | 199 | _GL_WARN_ON_USE (ceilf, "ceilf is unportable - " |
133 | "use gnulib module ceilf for portability"), \ | 200 | "use gnulib module ceilf for portability"); |
134 | ceilf (x)) | 201 | # endif |
135 | #endif | 202 | #endif |
136 | 203 | ||
137 | #if @GNULIB_CEILL@ | 204 | #if @GNULIB_CEILL@ |
138 | # if @REPLACE_CEILL@ | 205 | # if @REPLACE_CEILL@ |
139 | # define ceill rpl_ceill | 206 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE) |
140 | extern long double ceill (long double x); | 207 | # define ceill rpl_ceill |
208 | # endif | ||
209 | _GL_FUNCDECL_RPL (ceill, long double, (long double x)); | ||
210 | _GL_CXXALIAS_RPL (ceill, long double, (long double x)); | ||
211 | # else | ||
212 | # if !@HAVE_DECL_CEILL@ | ||
213 | _GL_FUNCDECL_SYS (ceill, long double, (long double x)); | ||
214 | # endif | ||
215 | _GL_CXXALIAS_SYS (ceill, long double, (long double x)); | ||
141 | # endif | 216 | # endif |
217 | _GL_CXXALIASWARN (ceill); | ||
142 | #elif defined GNULIB_POSIXCHECK | 218 | #elif defined GNULIB_POSIXCHECK |
143 | # undef ceill | 219 | # undef ceill |
144 | # define ceill(x) \ | 220 | # if HAVE_RAW_DECL_CEILL |
145 | (GL_LINK_WARNING ("ceill is unportable - " \ | 221 | _GL_WARN_ON_USE (ceill, "ceill is unportable - " |
146 | "use gnulib module ceill for portability"), \ | 222 | "use gnulib module ceill for portability"); |
147 | ceill (x)) | 223 | # endif |
148 | #endif | 224 | #endif |
149 | 225 | ||
150 | 226 | ||
151 | #if @GNULIB_MATHL@ || !@HAVE_DECL_COSL@ | 227 | #if @GNULIB_COSL@ |
152 | extern long double cosl (long double x); | 228 | # if !@HAVE_COSL@ || !@HAVE_DECL_COSL@ |
153 | #endif | 229 | _GL_FUNCDECL_SYS (cosl, long double, (long double x)); |
154 | #if !@GNULIB_MATHL@ && defined GNULIB_POSIXCHECK | 230 | # endif |
231 | _GL_CXXALIAS_SYS (cosl, long double, (long double x)); | ||
232 | _GL_CXXALIASWARN (cosl); | ||
233 | #elif defined GNULIB_POSIXCHECK | ||
155 | # undef cosl | 234 | # undef cosl |
156 | # define cosl(x) \ | 235 | # if HAVE_RAW_DECL_COSL |
157 | (GL_LINK_WARNING ("cosl is unportable - " \ | 236 | _GL_WARN_ON_USE (cosl, "cosl is unportable - " |
158 | "use gnulib module mathl for portability"), \ | 237 | "use gnulib module mathl for portability"); |
159 | cosl (x)) | 238 | # endif |
160 | #endif | 239 | #endif |
161 | 240 | ||
162 | 241 | ||
163 | #if @GNULIB_MATHL@ || !@HAVE_DECL_EXPL@ | 242 | #if @GNULIB_EXPL@ |
164 | extern long double expl (long double x); | 243 | # if !@HAVE_EXPL@ || !@HAVE_DECL_EXPL@ |
165 | #endif | 244 | _GL_FUNCDECL_SYS (expl, long double, (long double x)); |
166 | #if !@GNULIB_MATHL@ && defined GNULIB_POSIXCHECK | 245 | # endif |
246 | _GL_CXXALIAS_SYS (expl, long double, (long double x)); | ||
247 | _GL_CXXALIASWARN (expl); | ||
248 | #elif defined GNULIB_POSIXCHECK | ||
167 | # undef expl | 249 | # undef expl |
168 | # define expl(x) \ | 250 | # if HAVE_RAW_DECL_EXPL |
169 | (GL_LINK_WARNING ("expl is unportable - " \ | 251 | _GL_WARN_ON_USE (expl, "expl is unportable - " |
170 | "use gnulib module mathl for portability"), \ | 252 | "use gnulib module mathl for portability"); |
171 | expl (x)) | 253 | # endif |
172 | #endif | 254 | #endif |
173 | 255 | ||
174 | 256 | ||
175 | #if @GNULIB_FLOORF@ | 257 | #if @GNULIB_FLOORF@ |
176 | # if @REPLACE_FLOORF@ | 258 | # if @REPLACE_FLOORF@ |
177 | # define floorf rpl_floorf | 259 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE) |
178 | extern float floorf (float x); | 260 | # define floorf rpl_floorf |
261 | # endif | ||
262 | _GL_FUNCDECL_RPL (floorf, float, (float x)); | ||
263 | _GL_CXXALIAS_RPL (floorf, float, (float x)); | ||
264 | #else | ||
265 | # if !@HAVE_DECL_FLOORF@ | ||
266 | _GL_FUNCDECL_SYS (floorf, float, (float x)); | ||
267 | # endif | ||
268 | _GL_CXXALIAS_SYS (floorf, float, (float x)); | ||
179 | # endif | 269 | # endif |
270 | _GL_CXXALIASWARN (floorf); | ||
180 | #elif defined GNULIB_POSIXCHECK | 271 | #elif defined GNULIB_POSIXCHECK |
181 | # undef floorf | 272 | # undef floorf |
182 | # define floorf(x) \ | 273 | # if HAVE_RAW_DECL_FLOORF |
183 | (GL_LINK_WARNING ("floorf is unportable - " \ | 274 | _GL_WARN_ON_USE (floorf, "floorf is unportable - " |
184 | "use gnulib module floorf for portability"), \ | 275 | "use gnulib module floorf for portability"); |
185 | floorf (x)) | 276 | # endif |
186 | #endif | 277 | #endif |
187 | 278 | ||
188 | #if @GNULIB_FLOORL@ | 279 | #if @GNULIB_FLOORL@ |
189 | # if @REPLACE_FLOORL@ | 280 | # if @REPLACE_FLOORL@ |
190 | # define floorl rpl_floorl | 281 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE) |
191 | extern long double floorl (long double x); | 282 | # define floorl rpl_floorl |
283 | # endif | ||
284 | _GL_FUNCDECL_RPL (floorl, long double, (long double x)); | ||
285 | _GL_CXXALIAS_RPL (floorl, long double, (long double x)); | ||
286 | # else | ||
287 | # if !@HAVE_DECL_FLOORL@ | ||
288 | _GL_FUNCDECL_SYS (floorl, long double, (long double x)); | ||
289 | # endif | ||
290 | _GL_CXXALIAS_SYS (floorl, long double, (long double x)); | ||
192 | # endif | 291 | # endif |
292 | _GL_CXXALIASWARN (floorl); | ||
193 | #elif defined GNULIB_POSIXCHECK | 293 | #elif defined GNULIB_POSIXCHECK |
194 | # undef floorl | 294 | # undef floorl |
195 | # define floorl(x) \ | 295 | # if HAVE_RAW_DECL_FLOORL |
196 | (GL_LINK_WARNING ("floorl is unportable - " \ | 296 | _GL_WARN_ON_USE (floorl, "floorl is unportable - " |
197 | "use gnulib module floorl for portability"), \ | 297 | "use gnulib module floorl for portability"); |
198 | floorl (x)) | 298 | # endif |
199 | #endif | 299 | #endif |
200 | 300 | ||
201 | 301 | ||
@@ -207,173 +307,247 @@ extern long double floorl (long double x); | |||
207 | If x is infinite or NaN: mantissa = x, exp unspecified. | 307 | If x is infinite or NaN: mantissa = x, exp unspecified. |
208 | Store exp in *EXPPTR and return mantissa. */ | 308 | Store exp in *EXPPTR and return mantissa. */ |
209 | #if @GNULIB_FREXPL@ && @REPLACE_FREXPL@ | 309 | #if @GNULIB_FREXPL@ && @REPLACE_FREXPL@ |
210 | # define frexpl rpl_frexpl | 310 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE) |
311 | # define frexpl rpl_frexpl | ||
312 | # endif | ||
313 | _GL_FUNCDECL_RPL (frexpl, long double, | ||
314 | (long double x, int *expptr) _GL_ARG_NONNULL ((2))); | ||
315 | _GL_CXXALIAS_RPL (frexpl, long double, (long double x, int *expptr)); | ||
316 | #else | ||
317 | # if !@HAVE_DECL_FREXPL@ | ||
318 | _GL_FUNCDECL_SYS (frexpl, long double, | ||
319 | (long double x, int *expptr) _GL_ARG_NONNULL ((2))); | ||
320 | # endif | ||
321 | # if @GNULIB_FREXPL@ | ||
322 | _GL_CXXALIAS_SYS (frexpl, long double, (long double x, int *expptr)); | ||
323 | # endif | ||
211 | #endif | 324 | #endif |
212 | #if (@GNULIB_FREXPL@ && @REPLACE_FREXPL@) || !@HAVE_DECL_FREXPL@ | 325 | #if @GNULIB_FREXPL@ && !(@REPLACE_FREXPL@ && !@HAVE_DECL_FREXPL@) |
213 | extern long double frexpl (long double x, int *expptr); | 326 | _GL_CXXALIASWARN (frexpl); |
214 | #endif | 327 | #endif |
215 | #if !@GNULIB_FREXPL@ && defined GNULIB_POSIXCHECK | 328 | #if !@GNULIB_FREXPL@ && defined GNULIB_POSIXCHECK |
216 | # undef frexpl | 329 | # undef frexpl |
217 | # define frexpl(x,e) \ | 330 | # if HAVE_RAW_DECL_FREXPL |
218 | (GL_LINK_WARNING ("frexpl is unportable - " \ | 331 | _GL_WARN_ON_USE (frexpl, "frexpl is unportable - " |
219 | "use gnulib module frexpl for portability"), \ | 332 | "use gnulib module frexpl for portability"); |
220 | frexpl (x, e)) | 333 | # endif |
221 | #endif | 334 | #endif |
222 | 335 | ||
223 | 336 | ||
224 | /* Return x * 2^exp. */ | 337 | /* Return x * 2^exp. */ |
225 | #if @GNULIB_LDEXPL@ && @REPLACE_LDEXPL@ | 338 | #if @GNULIB_LDEXPL@ && @REPLACE_LDEXPL@ |
226 | # define ldexpl rpl_ldexpl | 339 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE) |
340 | # define ldexpl rpl_ldexpl | ||
341 | # endif | ||
342 | _GL_FUNCDECL_RPL (ldexpl, long double, (long double x, int exp)); | ||
343 | _GL_CXXALIAS_RPL (ldexpl, long double, (long double x, int exp)); | ||
344 | #else | ||
345 | # if !@HAVE_DECL_LDEXPL@ | ||
346 | _GL_FUNCDECL_SYS (ldexpl, long double, (long double x, int exp)); | ||
347 | # endif | ||
348 | # if @GNULIB_LDEXPL@ | ||
349 | _GL_CXXALIAS_SYS (ldexpl, long double, (long double x, int exp)); | ||
350 | # endif | ||
227 | #endif | 351 | #endif |
228 | #if (@GNULIB_LDEXPL@ && @REPLACE_LDEXPL@) || !@HAVE_DECL_LDEXPL@ | 352 | #if @GNULIB_LDEXPL@ |
229 | extern long double ldexpl (long double x, int exp); | 353 | _GL_CXXALIASWARN (ldexpl); |
230 | #endif | 354 | #endif |
231 | #if !@GNULIB_LDEXPL@ && defined GNULIB_POSIXCHECK | 355 | #if !@GNULIB_LDEXPL@ && defined GNULIB_POSIXCHECK |
232 | # undef ldexpl | 356 | # undef ldexpl |
233 | # define ldexpl(x,e) \ | 357 | # if HAVE_RAW_DECL_LDEXPL |
234 | (GL_LINK_WARNING ("ldexpl is unportable - " \ | 358 | _GL_WARN_ON_USE (ldexpl, "ldexpl is unportable - " |
235 | "use gnulib module ldexpl for portability"), \ | 359 | "use gnulib module ldexpl for portability"); |
236 | ldexpl (x, e)) | 360 | # endif |
237 | #endif | 361 | #endif |
238 | 362 | ||
239 | 363 | ||
240 | #if @GNULIB_MATHL@ || !@HAVE_DECL_LOGL@ | 364 | #if @GNULIB_LOGL@ |
241 | extern long double logl (long double x); | 365 | # if !@HAVE_LOGL@ || !@HAVE_DECL_LOGL@ |
242 | #endif | 366 | _GL_FUNCDECL_SYS (logl, long double, (long double x)); |
243 | #if !@GNULIB_MATHL@ && defined GNULIB_POSIXCHECK | 367 | # endif |
368 | _GL_CXXALIAS_SYS (logl, long double, (long double x)); | ||
369 | _GL_CXXALIASWARN (logl); | ||
370 | #elif defined GNULIB_POSIXCHECK | ||
244 | # undef logl | 371 | # undef logl |
245 | # define logl(x) \ | 372 | # if HAVE_RAW_DECL_LOGL |
246 | (GL_LINK_WARNING ("logl is unportable - " \ | 373 | _GL_WARN_ON_USE (logl, "logl is unportable - " |
247 | "use gnulib module mathl for portability"), \ | 374 | "use gnulib module mathl for portability"); |
248 | logl (x)) | 375 | # endif |
249 | #endif | 376 | #endif |
250 | 377 | ||
251 | 378 | ||
252 | #if @GNULIB_ROUNDF@ | 379 | #if @GNULIB_ROUNDF@ |
253 | # if @REPLACE_ROUNDF@ | 380 | # if @REPLACE_ROUNDF@ |
254 | # undef roundf | 381 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE) |
255 | # define roundf rpl_roundf | 382 | # undef roundf |
256 | extern float roundf (float x); | 383 | # define roundf rpl_roundf |
384 | # endif | ||
385 | _GL_FUNCDECL_RPL (roundf, float, (float x)); | ||
386 | _GL_CXXALIAS_RPL (roundf, float, (float x)); | ||
387 | # else | ||
388 | # if !@HAVE_DECL_ROUNDF@ | ||
389 | _GL_FUNCDECL_SYS (roundf, float, (float x)); | ||
390 | # endif | ||
391 | _GL_CXXALIAS_SYS (roundf, float, (float x)); | ||
257 | # endif | 392 | # endif |
393 | _GL_CXXALIASWARN (roundf); | ||
258 | #elif defined GNULIB_POSIXCHECK | 394 | #elif defined GNULIB_POSIXCHECK |
259 | # undef roundf | 395 | # undef roundf |
260 | # define roundf(x) \ | 396 | # if HAVE_RAW_DECL_ROUNDF |
261 | (GL_LINK_WARNING ("roundf is unportable - " \ | 397 | _GL_WARN_ON_USE (roundf, "roundf is unportable - " |
262 | "use gnulib module roundf for portability"), \ | 398 | "use gnulib module roundf for portability"); |
263 | roundf (x)) | 399 | # endif |
264 | #endif | 400 | #endif |
265 | 401 | ||
266 | #if @GNULIB_ROUND@ | 402 | #if @GNULIB_ROUND@ |
267 | # if @REPLACE_ROUND@ | 403 | # if @REPLACE_ROUND@ |
268 | # undef round | 404 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE) |
269 | # define round rpl_round | 405 | # undef round |
270 | extern double round (double x); | 406 | # define round rpl_round |
407 | # endif | ||
408 | _GL_FUNCDECL_RPL (round, double, (double x)); | ||
409 | _GL_CXXALIAS_RPL (round, double, (double x)); | ||
410 | # else | ||
411 | # if !@HAVE_DECL_ROUND@ | ||
412 | _GL_FUNCDECL_SYS (round, double, (double x)); | ||
413 | # endif | ||
414 | _GL_CXXALIAS_SYS (round, double, (double x)); | ||
271 | # endif | 415 | # endif |
416 | _GL_CXXALIASWARN (round); | ||
272 | #elif defined GNULIB_POSIXCHECK | 417 | #elif defined GNULIB_POSIXCHECK |
273 | # undef round | 418 | # undef round |
274 | # define round(x) \ | 419 | # if HAVE_RAW_DECL_ROUND |
275 | (GL_LINK_WARNING ("round is unportable - " \ | 420 | _GL_WARN_ON_USE (round, "round is unportable - " |
276 | "use gnulib module round for portability"), \ | 421 | "use gnulib module round for portability"); |
277 | round (x)) | 422 | # endif |
278 | #endif | 423 | #endif |
279 | 424 | ||
280 | #if @GNULIB_ROUNDL@ | 425 | #if @GNULIB_ROUNDL@ |
281 | # if @REPLACE_ROUNDL@ | 426 | # if @REPLACE_ROUNDL@ |
282 | # undef roundl | 427 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE) |
283 | # define roundl rpl_roundl | 428 | # undef roundl |
284 | extern long double roundl (long double x); | 429 | # define roundl rpl_roundl |
430 | # endif | ||
431 | _GL_FUNCDECL_RPL (roundl, long double, (long double x)); | ||
432 | _GL_CXXALIAS_RPL (roundl, long double, (long double x)); | ||
433 | # else | ||
434 | # if !@HAVE_DECL_ROUNDL@ | ||
435 | _GL_FUNCDECL_SYS (roundl, long double, (long double x)); | ||
436 | # endif | ||
437 | _GL_CXXALIAS_SYS (roundl, long double, (long double x)); | ||
285 | # endif | 438 | # endif |
439 | _GL_CXXALIASWARN (roundl); | ||
286 | #elif defined GNULIB_POSIXCHECK | 440 | #elif defined GNULIB_POSIXCHECK |
287 | # undef roundl | 441 | # undef roundl |
288 | # define roundl(x) \ | 442 | # if HAVE_RAW_DECL_ROUNDL |
289 | (GL_LINK_WARNING ("roundl is unportable - " \ | 443 | _GL_WARN_ON_USE (roundl, "roundl is unportable - " |
290 | "use gnulib module roundl for portability"), \ | 444 | "use gnulib module roundl for portability"); |
291 | roundl (x)) | 445 | # endif |
292 | #endif | 446 | #endif |
293 | 447 | ||
294 | 448 | ||
295 | #if @GNULIB_MATHL@ || !@HAVE_DECL_SINL@ | 449 | #if @GNULIB_SINL@ |
296 | extern long double sinl (long double x); | 450 | # if !@HAVE_SINL@ || !@HAVE_DECL_SINL@ |
297 | #endif | 451 | _GL_FUNCDECL_SYS (sinl, long double, (long double x)); |
298 | #if !@GNULIB_MATHL@ && defined GNULIB_POSIXCHECK | 452 | # endif |
453 | _GL_CXXALIAS_SYS (sinl, long double, (long double x)); | ||
454 | _GL_CXXALIASWARN (sinl); | ||
455 | #elif defined GNULIB_POSIXCHECK | ||
299 | # undef sinl | 456 | # undef sinl |
300 | # define sinl(x) \ | 457 | # if HAVE_RAW_DECL_SINL |
301 | (GL_LINK_WARNING ("sinl is unportable - " \ | 458 | _GL_WARN_ON_USE (sinl, "sinl is unportable - " |
302 | "use gnulib module mathl for portability"), \ | 459 | "use gnulib module mathl for portability"); |
303 | sinl (x)) | 460 | # endif |
304 | #endif | 461 | #endif |
305 | 462 | ||
306 | 463 | ||
307 | #if @GNULIB_MATHL@ || !@HAVE_DECL_SQRTL@ | 464 | #if @GNULIB_SQRTL@ |
308 | extern long double sqrtl (long double x); | 465 | # if !@HAVE_SQRTL@ || !@HAVE_DECL_SQRTL@ |
309 | #endif | 466 | _GL_FUNCDECL_SYS (sqrtl, long double, (long double x)); |
310 | #if !@GNULIB_MATHL@ && defined GNULIB_POSIXCHECK | 467 | # endif |
468 | _GL_CXXALIAS_SYS (sqrtl, long double, (long double x)); | ||
469 | _GL_CXXALIASWARN (sqrtl); | ||
470 | #elif defined GNULIB_POSIXCHECK | ||
311 | # undef sqrtl | 471 | # undef sqrtl |
312 | # define sqrtl(x) \ | 472 | # if HAVE_RAW_DECL_SQRTL |
313 | (GL_LINK_WARNING ("sqrtl is unportable - " \ | 473 | _GL_WARN_ON_USE (sqrtl, "sqrtl is unportable - " |
314 | "use gnulib module mathl for portability"), \ | 474 | "use gnulib module mathl for portability"); |
315 | sqrtl (x)) | 475 | # endif |
316 | #endif | 476 | #endif |
317 | 477 | ||
318 | 478 | ||
319 | #if @GNULIB_MATHL@ || !@HAVE_DECL_TANL@ | 479 | #if @GNULIB_TANL@ |
320 | extern long double tanl (long double x); | 480 | # if !@HAVE_TANL@ || !@HAVE_DECL_TANL@ |
321 | #endif | 481 | _GL_FUNCDECL_SYS (tanl, long double, (long double x)); |
322 | #if !@GNULIB_MATHL@ && defined GNULIB_POSIXCHECK | 482 | # endif |
483 | _GL_CXXALIAS_SYS (tanl, long double, (long double x)); | ||
484 | _GL_CXXALIASWARN (tanl); | ||
485 | #elif defined GNULIB_POSIXCHECK | ||
323 | # undef tanl | 486 | # undef tanl |
324 | # define tanl(x) \ | 487 | # if HAVE_RAW_DECL_TANL |
325 | (GL_LINK_WARNING ("tanl is unportable - " \ | 488 | _GL_WARN_ON_USE (tanl, "tanl is unportable - " |
326 | "use gnulib module mathl for portability"), \ | 489 | "use gnulib module mathl for portability"); |
327 | tanl (x)) | 490 | # endif |
328 | #endif | 491 | #endif |
329 | 492 | ||
330 | 493 | ||
331 | #if @GNULIB_TRUNCF@ | 494 | #if @GNULIB_TRUNCF@ |
332 | # if !@HAVE_DECL_TRUNCF@ | 495 | # if !@HAVE_DECL_TRUNCF@ |
333 | # define truncf rpl_truncf | 496 | _GL_FUNCDECL_SYS (truncf, float, (float x)); |
334 | extern float truncf (float x); | ||
335 | # endif | 497 | # endif |
498 | _GL_CXXALIAS_SYS (truncf, float, (float x)); | ||
499 | _GL_CXXALIASWARN (truncf); | ||
336 | #elif defined GNULIB_POSIXCHECK | 500 | #elif defined GNULIB_POSIXCHECK |
337 | # undef truncf | 501 | # undef truncf |
338 | # define truncf(x) \ | 502 | # if HAVE_RAW_DECL_TRUNCF |
339 | (GL_LINK_WARNING ("truncf is unportable - " \ | 503 | _GL_WARN_ON_USE (truncf, "truncf is unportable - " |
340 | "use gnulib module truncf for portability"), \ | 504 | "use gnulib module truncf for portability"); |
341 | truncf (x)) | 505 | # endif |
342 | #endif | 506 | #endif |
343 | 507 | ||
344 | #if @GNULIB_TRUNC@ | 508 | #if @GNULIB_TRUNC@ |
345 | # if !@HAVE_DECL_TRUNC@ | 509 | # if !@HAVE_DECL_TRUNC@ |
346 | # define trunc rpl_trunc | 510 | _GL_FUNCDECL_SYS (trunc, double, (double x)); |
347 | extern double trunc (double x); | ||
348 | # endif | 511 | # endif |
512 | _GL_CXXALIAS_SYS (trunc, double, (double x)); | ||
513 | _GL_CXXALIASWARN (trunc); | ||
349 | #elif defined GNULIB_POSIXCHECK | 514 | #elif defined GNULIB_POSIXCHECK |
350 | # undef trunc | 515 | # undef trunc |
351 | # define trunc(x) \ | 516 | # if HAVE_RAW_DECL_TRUNC |
352 | (GL_LINK_WARNING ("trunc is unportable - " \ | 517 | _GL_WARN_ON_USE (trunc, "trunc is unportable - " |
353 | "use gnulib module trunc for portability"), \ | 518 | "use gnulib module trunc for portability"); |
354 | trunc (x)) | 519 | # endif |
355 | #endif | 520 | #endif |
356 | 521 | ||
357 | #if @GNULIB_TRUNCL@ | 522 | #if @GNULIB_TRUNCL@ |
358 | # if @REPLACE_TRUNCL@ | 523 | # if @REPLACE_TRUNCL@ |
359 | # undef truncl | 524 | # if !(defined __cplusplus && defined GNULIB_NAMESPACE) |
360 | # define truncl rpl_truncl | 525 | # undef truncl |
361 | extern long double truncl (long double x); | 526 | # define truncl rpl_truncl |
527 | # endif | ||
528 | _GL_FUNCDECL_RPL (truncl, long double, (long double x)); | ||
529 | _GL_CXXALIAS_RPL (truncl, long double, (long double x)); | ||
530 | # else | ||
531 | # if !@HAVE_DECL_TRUNCL@ | ||
532 | _GL_FUNCDECL_SYS (truncl, long double, (long double x)); | ||
533 | # endif | ||
534 | _GL_CXXALIAS_SYS (truncl, long double, (long double x)); | ||
362 | # endif | 535 | # endif |
536 | _GL_CXXALIASWARN (truncl); | ||
363 | #elif defined GNULIB_POSIXCHECK | 537 | #elif defined GNULIB_POSIXCHECK |
364 | # undef truncl | 538 | # undef truncl |
365 | # define truncl(x) \ | 539 | # if HAVE_RAW_DECL_TRUNCL |
366 | (GL_LINK_WARNING ("truncl is unportable - " \ | 540 | _GL_WARN_ON_USE (truncl, "truncl is unportable - " |
367 | "use gnulib module truncl for portability"), \ | 541 | "use gnulib module truncl for portability"); |
368 | truncl (x)) | 542 | # endif |
369 | #endif | 543 | #endif |
370 | 544 | ||
371 | 545 | ||
372 | #if @GNULIB_ISFINITE@ | 546 | #if @GNULIB_ISFINITE@ |
373 | # if @REPLACE_ISFINITE@ | 547 | # if @REPLACE_ISFINITE@ |
374 | extern int gl_isfinitef (float x); | 548 | _GL_EXTERN_C int gl_isfinitef (float x); |
375 | extern int gl_isfinited (double x); | 549 | _GL_EXTERN_C int gl_isfinited (double x); |
376 | extern int gl_isfinitel (long double x); | 550 | _GL_EXTERN_C int gl_isfinitel (long double x); |
377 | # undef isfinite | 551 | # undef isfinite |
378 | # define isfinite(x) \ | 552 | # define isfinite(x) \ |
379 | (sizeof (x) == sizeof (long double) ? gl_isfinitel (x) : \ | 553 | (sizeof (x) == sizeof (long double) ? gl_isfinitel (x) : \ |
@@ -381,15 +555,19 @@ extern int gl_isfinitel (long double x); | |||
381 | gl_isfinitef (x)) | 555 | gl_isfinitef (x)) |
382 | # endif | 556 | # endif |
383 | #elif defined GNULIB_POSIXCHECK | 557 | #elif defined GNULIB_POSIXCHECK |
384 | /* How to override a macro? */ | 558 | # if defined isfinite |
559 | _GL_WARN_REAL_FLOATING_DECL (isfinite); | ||
560 | # undef isfinite | ||
561 | # define isfinite(x) _GL_WARN_REAL_FLOATING_IMPL (isfinite, x) | ||
562 | # endif | ||
385 | #endif | 563 | #endif |
386 | 564 | ||
387 | 565 | ||
388 | #if @GNULIB_ISINF@ | 566 | #if @GNULIB_ISINF@ |
389 | # if @REPLACE_ISINF@ | 567 | # if @REPLACE_ISINF@ |
390 | extern int gl_isinff (float x); | 568 | _GL_EXTERN_C int gl_isinff (float x); |
391 | extern int gl_isinfd (double x); | 569 | _GL_EXTERN_C int gl_isinfd (double x); |
392 | extern int gl_isinfl (long double x); | 570 | _GL_EXTERN_C int gl_isinfl (long double x); |
393 | # undef isinf | 571 | # undef isinf |
394 | # define isinf(x) \ | 572 | # define isinf(x) \ |
395 | (sizeof (x) == sizeof (long double) ? gl_isinfl (x) : \ | 573 | (sizeof (x) == sizeof (long double) ? gl_isinfl (x) : \ |
@@ -397,7 +575,11 @@ extern int gl_isinfl (long double x); | |||
397 | gl_isinff (x)) | 575 | gl_isinff (x)) |
398 | # endif | 576 | # endif |
399 | #elif defined GNULIB_POSIXCHECK | 577 | #elif defined GNULIB_POSIXCHECK |
400 | /* How to override a macro? */ | 578 | # if defined isinf |
579 | _GL_WARN_REAL_FLOATING_DECL (isinf); | ||
580 | # undef isinf | ||
581 | # define isinf(x) _GL_WARN_REAL_FLOATING_IMPL (isinf, x) | ||
582 | # endif | ||
401 | #endif | 583 | #endif |
402 | 584 | ||
403 | 585 | ||
@@ -406,7 +588,6 @@ extern int gl_isinfl (long double x); | |||
406 | # if @HAVE_ISNANF@ | 588 | # if @HAVE_ISNANF@ |
407 | /* The original <math.h> included above provides a declaration of isnan macro | 589 | /* The original <math.h> included above provides a declaration of isnan macro |
408 | or (older) isnanf function. */ | 590 | or (older) isnanf function. */ |
409 | # include <math.h> | ||
410 | # if __GNUC__ >= 4 | 591 | # if __GNUC__ >= 4 |
411 | /* GCC 4.0 and newer provides three built-ins for isnan. */ | 592 | /* GCC 4.0 and newer provides three built-ins for isnan. */ |
412 | # undef isnanf | 593 | # undef isnanf |
@@ -419,7 +600,7 @@ extern int gl_isinfl (long double x); | |||
419 | /* Test whether X is a NaN. */ | 600 | /* Test whether X is a NaN. */ |
420 | # undef isnanf | 601 | # undef isnanf |
421 | # define isnanf rpl_isnanf | 602 | # define isnanf rpl_isnanf |
422 | extern int isnanf (float x); | 603 | _GL_EXTERN_C int isnanf (float x); |
423 | # endif | 604 | # endif |
424 | #endif | 605 | #endif |
425 | 606 | ||
@@ -429,7 +610,6 @@ extern int isnanf (float x); | |||
429 | to 'double' numbers earlier but now is a type-generic macro. */ | 610 | to 'double' numbers earlier but now is a type-generic macro. */ |
430 | # if @HAVE_ISNAND@ | 611 | # if @HAVE_ISNAND@ |
431 | /* The original <math.h> included above provides a declaration of isnan macro. */ | 612 | /* The original <math.h> included above provides a declaration of isnan macro. */ |
432 | # include <math.h> | ||
433 | # if __GNUC__ >= 4 | 613 | # if __GNUC__ >= 4 |
434 | /* GCC 4.0 and newer provides three built-ins for isnan. */ | 614 | /* GCC 4.0 and newer provides three built-ins for isnan. */ |
435 | # undef isnand | 615 | # undef isnand |
@@ -442,7 +622,7 @@ extern int isnanf (float x); | |||
442 | /* Test whether X is a NaN. */ | 622 | /* Test whether X is a NaN. */ |
443 | # undef isnand | 623 | # undef isnand |
444 | # define isnand rpl_isnand | 624 | # define isnand rpl_isnand |
445 | extern int isnand (double x); | 625 | _GL_EXTERN_C int isnand (double x); |
446 | # endif | 626 | # endif |
447 | #endif | 627 | #endif |
448 | 628 | ||
@@ -450,7 +630,6 @@ extern int isnand (double x); | |||
450 | /* Test for NaN for 'long double' numbers. */ | 630 | /* Test for NaN for 'long double' numbers. */ |
451 | # if @HAVE_ISNANL@ | 631 | # if @HAVE_ISNANL@ |
452 | /* The original <math.h> included above provides a declaration of isnan macro or (older) isnanl function. */ | 632 | /* The original <math.h> included above provides a declaration of isnan macro or (older) isnanl function. */ |
453 | # include <math.h> | ||
454 | # if __GNUC__ >= 4 | 633 | # if __GNUC__ >= 4 |
455 | /* GCC 4.0 and newer provides three built-ins for isnan. */ | 634 | /* GCC 4.0 and newer provides three built-ins for isnan. */ |
456 | # undef isnanl | 635 | # undef isnanl |
@@ -463,7 +642,7 @@ extern int isnand (double x); | |||
463 | /* Test whether X is a NaN. */ | 642 | /* Test whether X is a NaN. */ |
464 | # undef isnanl | 643 | # undef isnanl |
465 | # define isnanl rpl_isnanl | 644 | # define isnanl rpl_isnanl |
466 | extern int isnanl (long double x); | 645 | _GL_EXTERN_C int isnanl (long double x); |
467 | # endif | 646 | # endif |
468 | #endif | 647 | #endif |
469 | 648 | ||
@@ -477,19 +656,19 @@ extern int isnanl (long double x); | |||
477 | # if @HAVE_ISNANF@ && __GNUC__ >= 4 | 656 | # if @HAVE_ISNANF@ && __GNUC__ >= 4 |
478 | # define gl_isnan_f(x) __builtin_isnan ((float)(x)) | 657 | # define gl_isnan_f(x) __builtin_isnan ((float)(x)) |
479 | # else | 658 | # else |
480 | extern int rpl_isnanf (float x); | 659 | _GL_EXTERN_C int rpl_isnanf (float x); |
481 | # define gl_isnan_f(x) rpl_isnanf (x) | 660 | # define gl_isnan_f(x) rpl_isnanf (x) |
482 | # endif | 661 | # endif |
483 | # if @HAVE_ISNAND@ && __GNUC__ >= 4 | 662 | # if @HAVE_ISNAND@ && __GNUC__ >= 4 |
484 | # define gl_isnan_d(x) __builtin_isnan ((double)(x)) | 663 | # define gl_isnan_d(x) __builtin_isnan ((double)(x)) |
485 | # else | 664 | # else |
486 | extern int rpl_isnand (double x); | 665 | _GL_EXTERN_C int rpl_isnand (double x); |
487 | # define gl_isnan_d(x) rpl_isnand (x) | 666 | # define gl_isnan_d(x) rpl_isnand (x) |
488 | # endif | 667 | # endif |
489 | # if @HAVE_ISNANL@ && __GNUC__ >= 4 | 668 | # if @HAVE_ISNANL@ && __GNUC__ >= 4 |
490 | # define gl_isnan_l(x) __builtin_isnan ((long double)(x)) | 669 | # define gl_isnan_l(x) __builtin_isnan ((long double)(x)) |
491 | # else | 670 | # else |
492 | extern int rpl_isnanl (long double x); | 671 | _GL_EXTERN_C int rpl_isnanl (long double x); |
493 | # define gl_isnan_l(x) rpl_isnanl (x) | 672 | # define gl_isnan_l(x) rpl_isnanl (x) |
494 | # endif | 673 | # endif |
495 | # undef isnan | 674 | # undef isnan |
@@ -499,7 +678,11 @@ extern int rpl_isnanl (long double x); | |||
499 | gl_isnan_f (x)) | 678 | gl_isnan_f (x)) |
500 | # endif | 679 | # endif |
501 | #elif defined GNULIB_POSIXCHECK | 680 | #elif defined GNULIB_POSIXCHECK |
502 | /* How to override a macro? */ | 681 | # if defined isnan |
682 | _GL_WARN_REAL_FLOATING_DECL (isnan); | ||
683 | # undef isnan | ||
684 | # define isnan(x) _GL_WARN_REAL_FLOATING_IMPL (isnan, x) | ||
685 | # endif | ||
503 | #endif | 686 | #endif |
504 | 687 | ||
505 | 688 | ||
@@ -514,38 +697,38 @@ extern int rpl_isnanl (long double x); | |||
514 | # endif | 697 | # endif |
515 | # if @REPLACE_SIGNBIT@ | 698 | # if @REPLACE_SIGNBIT@ |
516 | # undef signbit | 699 | # undef signbit |
517 | extern int gl_signbitf (float arg); | 700 | _GL_EXTERN_C int gl_signbitf (float arg); |
518 | extern int gl_signbitd (double arg); | 701 | _GL_EXTERN_C int gl_signbitd (double arg); |
519 | extern int gl_signbitl (long double arg); | 702 | _GL_EXTERN_C int gl_signbitl (long double arg); |
520 | # if __GNUC__ >= 2 && !__STRICT_ANSI__ | 703 | # if __GNUC__ >= 2 && !__STRICT_ANSI__ |
521 | # if defined FLT_SIGNBIT_WORD && defined FLT_SIGNBIT_BIT && !defined gl_signbitf | 704 | # if defined FLT_SIGNBIT_WORD && defined FLT_SIGNBIT_BIT && !defined gl_signbitf |
522 | # define gl_signbitf_OPTIMIZED_MACRO | 705 | # define gl_signbitf_OPTIMIZED_MACRO |
523 | # define gl_signbitf(arg) \ | 706 | # define gl_signbitf(arg) \ |
524 | ({ union { float _value; \ | 707 | ({ union { float _value; \ |
525 | unsigned int _word[(sizeof (float) + sizeof (unsigned int) - 1) / sizeof (unsigned int)]; \ | 708 | unsigned int _word[(sizeof (float) + sizeof (unsigned int) - 1) / sizeof (unsigned int)]; \ |
526 | } _m; \ | 709 | } _m; \ |
527 | _m._value = (arg); \ | 710 | _m._value = (arg); \ |
528 | (_m._word[FLT_SIGNBIT_WORD] >> FLT_SIGNBIT_BIT) & 1; \ | 711 | (_m._word[FLT_SIGNBIT_WORD] >> FLT_SIGNBIT_BIT) & 1; \ |
529 | }) | 712 | }) |
530 | # endif | 713 | # endif |
531 | # if defined DBL_SIGNBIT_WORD && defined DBL_SIGNBIT_BIT && !defined gl_signbitd | 714 | # if defined DBL_SIGNBIT_WORD && defined DBL_SIGNBIT_BIT && !defined gl_signbitd |
532 | # define gl_signbitd_OPTIMIZED_MACRO | 715 | # define gl_signbitd_OPTIMIZED_MACRO |
533 | # define gl_signbitd(arg) \ | 716 | # define gl_signbitd(arg) \ |
534 | ({ union { double _value; \ | 717 | ({ union { double _value; \ |
535 | unsigned int _word[(sizeof (double) + sizeof (unsigned int) - 1) / sizeof (unsigned int)]; \ | 718 | unsigned int _word[(sizeof (double) + sizeof (unsigned int) - 1) / sizeof (unsigned int)]; \ |
536 | } _m; \ | 719 | } _m; \ |
537 | _m._value = (arg); \ | 720 | _m._value = (arg); \ |
538 | (_m._word[DBL_SIGNBIT_WORD] >> DBL_SIGNBIT_BIT) & 1; \ | 721 | (_m._word[DBL_SIGNBIT_WORD] >> DBL_SIGNBIT_BIT) & 1; \ |
539 | }) | 722 | }) |
540 | # endif | 723 | # endif |
541 | # if defined LDBL_SIGNBIT_WORD && defined LDBL_SIGNBIT_BIT && !defined gl_signbitl | 724 | # if defined LDBL_SIGNBIT_WORD && defined LDBL_SIGNBIT_BIT && !defined gl_signbitl |
542 | # define gl_signbitl_OPTIMIZED_MACRO | 725 | # define gl_signbitl_OPTIMIZED_MACRO |
543 | # define gl_signbitl(arg) \ | 726 | # define gl_signbitl(arg) \ |
544 | ({ union { long double _value; \ | 727 | ({ union { long double _value; \ |
545 | unsigned int _word[(sizeof (long double) + sizeof (unsigned int) - 1) / sizeof (unsigned int)]; \ | 728 | unsigned int _word[(sizeof (long double) + sizeof (unsigned int) - 1) / sizeof (unsigned int)]; \ |
546 | } _m; \ | 729 | } _m; \ |
547 | _m._value = (arg); \ | 730 | _m._value = (arg); \ |
548 | (_m._word[LDBL_SIGNBIT_WORD] >> LDBL_SIGNBIT_BIT) & 1; \ | 731 | (_m._word[LDBL_SIGNBIT_WORD] >> LDBL_SIGNBIT_BIT) & 1; \ |
549 | }) | 732 | }) |
550 | # endif | 733 | # endif |
551 | # endif | 734 | # endif |
@@ -555,13 +738,13 @@ extern int gl_signbitl (long double arg); | |||
555 | gl_signbitf (x)) | 738 | gl_signbitf (x)) |
556 | # endif | 739 | # endif |
557 | #elif defined GNULIB_POSIXCHECK | 740 | #elif defined GNULIB_POSIXCHECK |
558 | /* How to override a macro? */ | 741 | # if defined signbit |
742 | _GL_WARN_REAL_FLOATING_DECL (signbit); | ||
743 | # undef signbit | ||
744 | # define signbit(x) _GL_WARN_REAL_FLOATING_IMPL (signbit, x) | ||
745 | # endif | ||
559 | #endif | 746 | #endif |
560 | 747 | ||
561 | 748 | ||
562 | #ifdef __cplusplus | ||
563 | } | ||
564 | #endif | ||
565 | |||
566 | #endif /* _GL_MATH_H */ | 749 | #endif /* _GL_MATH_H */ |
567 | #endif /* _GL_MATH_H */ | 750 | #endif /* _GL_MATH_H */ |