S390: Move utf8-utf32-z9.c to multiarch folder and use s390_libc_ifunc_expr macro.
[glibc.git] / math / tgmath.h
blob01730a44fcdfe85d61cd6a66b74dda9b38c51bcc
1 /* Copyright (C) 1997-2017 Free Software Foundation, Inc.
2 This file is part of the GNU C Library.
4 The GNU C Library is free software; you can redistribute it and/or
5 modify it under the terms of the GNU Lesser General Public
6 License as published by the Free Software Foundation; either
7 version 2.1 of the License, or (at your option) any later version.
9 The GNU C Library 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 GNU
12 Lesser General Public License for more details.
14 You should have received a copy of the GNU Lesser General Public
15 License along with the GNU C Library; if not, see
16 <http://www.gnu.org/licenses/>. */
19 * ISO C99 Standard: 7.22 Type-generic math <tgmath.h>
22 #ifndef _TGMATH_H
23 #define _TGMATH_H 1
25 /* Include the needed headers. */
26 #include <math.h>
27 #include <complex.h>
30 /* Since `complex' is currently not really implemented in most C compilers
31 and if it is implemented, the implementations differ. This makes it
32 quite difficult to write a generic implementation of this header. We
33 do not try this for now and instead concentrate only on GNU CC. Once
34 we have more information support for other compilers might follow. */
36 #if __GNUC_PREREQ (2, 7)
38 # ifdef __NO_LONG_DOUBLE_MATH
39 # define __tgml(fct) fct
40 # else
41 # define __tgml(fct) fct ## l
42 # endif
44 /* This is ugly but unless gcc gets appropriate builtins we have to do
45 something like this. Don't ask how it works. */
47 /* 1 if 'type' is a floating type, 0 if 'type' is an integer type.
48 Allows for _Bool. Expands to an integer constant expression. */
49 # if __GNUC_PREREQ (3, 1)
50 # define __floating_type(type) \
51 (__builtin_classify_type ((type) 0) == 8 \
52 || (__builtin_classify_type ((type) 0) == 9 \
53 && __builtin_classify_type (__real__ ((type) 0)) == 8))
54 # else
55 # define __floating_type(type) (((type) 0.25) && ((type) 0.25 - 1))
56 # endif
58 /* The tgmath real type for T, where E is 0 if T is an integer type and
59 1 for a floating type. */
60 # define __tgmath_real_type_sub(T, E) \
61 __typeof__ (*(0 ? (__typeof__ (0 ? (double *) 0 : (void *) (E))) 0 \
62 : (__typeof__ (0 ? (T *) 0 : (void *) (!(E)))) 0))
64 /* The tgmath real type of EXPR. */
65 # define __tgmath_real_type(expr) \
66 __tgmath_real_type_sub (__typeof__ ((__typeof__ (expr)) 0), \
67 __floating_type (__typeof__ (expr)))
70 /* We have two kinds of generic macros: to support functions which are
71 only defined on real valued parameters and those which are defined
72 for complex functions as well. */
73 # define __TGMATH_UNARY_REAL_ONLY(Val, Fct) \
74 (__extension__ ((sizeof (Val) == sizeof (double) \
75 || __builtin_classify_type (Val) != 8) \
76 ? (__tgmath_real_type (Val)) Fct (Val) \
77 : (sizeof (Val) == sizeof (float)) \
78 ? (__tgmath_real_type (Val)) Fct##f (Val) \
79 : (__tgmath_real_type (Val)) __tgml(Fct) (Val)))
81 # define __TGMATH_UNARY_REAL_RET_ONLY(Val, RetType, Fct) \
82 (__extension__ ((sizeof (Val) == sizeof (double) \
83 || __builtin_classify_type (Val) != 8) \
84 ? (RetType) Fct (Val) \
85 : (sizeof (Val) == sizeof (float)) \
86 ? (RetType) Fct##f (Val) \
87 : (RetType) __tgml(Fct) (Val)))
89 # define __TGMATH_BINARY_FIRST_REAL_ONLY(Val1, Val2, Fct) \
90 (__extension__ ((sizeof (Val1) == sizeof (double) \
91 || __builtin_classify_type (Val1) != 8) \
92 ? (__tgmath_real_type (Val1)) Fct (Val1, Val2) \
93 : (sizeof (Val1) == sizeof (float)) \
94 ? (__tgmath_real_type (Val1)) Fct##f (Val1, Val2) \
95 : (__tgmath_real_type (Val1)) __tgml(Fct) (Val1, Val2)))
97 # define __TGMATH_BINARY_REAL_ONLY(Val1, Val2, Fct) \
98 (__extension__ (((sizeof (Val1) > sizeof (double) \
99 || sizeof (Val2) > sizeof (double)) \
100 && __builtin_classify_type ((Val1) + (Val2)) == 8) \
101 ? (__typeof ((__tgmath_real_type (Val1)) 0 \
102 + (__tgmath_real_type (Val2)) 0)) \
103 __tgml(Fct) (Val1, Val2) \
104 : (sizeof (Val1) == sizeof (double) \
105 || sizeof (Val2) == sizeof (double) \
106 || __builtin_classify_type (Val1) != 8 \
107 || __builtin_classify_type (Val2) != 8) \
108 ? (__typeof ((__tgmath_real_type (Val1)) 0 \
109 + (__tgmath_real_type (Val2)) 0)) \
110 Fct (Val1, Val2) \
111 : (__typeof ((__tgmath_real_type (Val1)) 0 \
112 + (__tgmath_real_type (Val2)) 0)) \
113 Fct##f (Val1, Val2)))
115 # define __TGMATH_TERNARY_FIRST_SECOND_REAL_ONLY(Val1, Val2, Val3, Fct) \
116 (__extension__ (((sizeof (Val1) > sizeof (double) \
117 || sizeof (Val2) > sizeof (double)) \
118 && __builtin_classify_type ((Val1) + (Val2)) == 8) \
119 ? (__typeof ((__tgmath_real_type (Val1)) 0 \
120 + (__tgmath_real_type (Val2)) 0)) \
121 __tgml(Fct) (Val1, Val2, Val3) \
122 : (sizeof (Val1) == sizeof (double) \
123 || sizeof (Val2) == sizeof (double) \
124 || __builtin_classify_type (Val1) != 8 \
125 || __builtin_classify_type (Val2) != 8) \
126 ? (__typeof ((__tgmath_real_type (Val1)) 0 \
127 + (__tgmath_real_type (Val2)) 0)) \
128 Fct (Val1, Val2, Val3) \
129 : (__typeof ((__tgmath_real_type (Val1)) 0 \
130 + (__tgmath_real_type (Val2)) 0)) \
131 Fct##f (Val1, Val2, Val3)))
133 # define __TGMATH_TERNARY_REAL_ONLY(Val1, Val2, Val3, Fct) \
134 (__extension__ (((sizeof (Val1) > sizeof (double) \
135 || sizeof (Val2) > sizeof (double) \
136 || sizeof (Val3) > sizeof (double)) \
137 && __builtin_classify_type ((Val1) + (Val2) + (Val3)) \
138 == 8) \
139 ? (__typeof ((__tgmath_real_type (Val1)) 0 \
140 + (__tgmath_real_type (Val2)) 0 \
141 + (__tgmath_real_type (Val3)) 0)) \
142 __tgml(Fct) (Val1, Val2, Val3) \
143 : (sizeof (Val1) == sizeof (double) \
144 || sizeof (Val2) == sizeof (double) \
145 || sizeof (Val3) == sizeof (double) \
146 || __builtin_classify_type (Val1) != 8 \
147 || __builtin_classify_type (Val2) != 8 \
148 || __builtin_classify_type (Val3) != 8) \
149 ? (__typeof ((__tgmath_real_type (Val1)) 0 \
150 + (__tgmath_real_type (Val2)) 0 \
151 + (__tgmath_real_type (Val3)) 0)) \
152 Fct (Val1, Val2, Val3) \
153 : (__typeof ((__tgmath_real_type (Val1)) 0 \
154 + (__tgmath_real_type (Val2)) 0 \
155 + (__tgmath_real_type (Val3)) 0)) \
156 Fct##f (Val1, Val2, Val3)))
158 # define __TGMATH_TERNARY_FIRST_REAL_RET_ONLY(Val1, Val2, Val3, RetType, Fct) \
159 (__extension__ ((sizeof (Val1) == sizeof (double) \
160 || __builtin_classify_type (Val1) != 8) \
161 ? (RetType) Fct (Val1, Val2, Val3) \
162 : (sizeof (Val1) == sizeof (float)) \
163 ? (RetType) Fct##f (Val1, Val2, Val3) \
164 : (RetType) __tgml(Fct) (Val1, Val2, Val3)))
166 /* XXX This definition has to be changed as soon as the compiler understands
167 the imaginary keyword. */
168 # define __TGMATH_UNARY_REAL_IMAG(Val, Fct, Cfct) \
169 (__extension__ ((sizeof (__real__ (Val)) == sizeof (double) \
170 || __builtin_classify_type (__real__ (Val)) != 8) \
171 ? ((sizeof (__real__ (Val)) == sizeof (Val)) \
172 ? (__tgmath_real_type (Val)) Fct (Val) \
173 : (__tgmath_real_type (Val)) Cfct (Val)) \
174 : (sizeof (__real__ (Val)) == sizeof (float)) \
175 ? ((sizeof (__real__ (Val)) == sizeof (Val)) \
176 ? (__tgmath_real_type (Val)) Fct##f (Val) \
177 : (__tgmath_real_type (Val)) Cfct##f (Val)) \
178 : ((sizeof (__real__ (Val)) == sizeof (Val)) \
179 ? (__tgmath_real_type (Val)) __tgml(Fct) (Val) \
180 : (__tgmath_real_type (Val)) __tgml(Cfct) (Val))))
182 # define __TGMATH_UNARY_IMAG(Val, Cfct) \
183 (__extension__ ((sizeof (__real__ (Val)) == sizeof (double) \
184 || __builtin_classify_type (__real__ (Val)) != 8) \
185 ? (__typeof__ ((__tgmath_real_type (Val)) 0 \
186 + _Complex_I)) Cfct (Val) \
187 : (sizeof (__real__ (Val)) == sizeof (float)) \
188 ? (__typeof__ ((__tgmath_real_type (Val)) 0 \
189 + _Complex_I)) Cfct##f (Val) \
190 : (__typeof__ ((__tgmath_real_type (Val)) 0 \
191 + _Complex_I)) __tgml(Cfct) (Val)))
193 /* XXX This definition has to be changed as soon as the compiler understands
194 the imaginary keyword. */
195 # define __TGMATH_UNARY_REAL_IMAG_RET_REAL(Val, Fct, Cfct) \
196 (__extension__ ((sizeof (__real__ (Val)) == sizeof (double) \
197 || __builtin_classify_type (__real__ (Val)) != 8) \
198 ? ((sizeof (__real__ (Val)) == sizeof (Val)) \
199 ? (__typeof__ (__real__ (__tgmath_real_type (Val)) 0))\
200 Fct (Val) \
201 : (__typeof__ (__real__ (__tgmath_real_type (Val)) 0))\
202 Cfct (Val)) \
203 : (sizeof (__real__ (Val)) == sizeof (float)) \
204 ? ((sizeof (__real__ (Val)) == sizeof (Val)) \
205 ? (__typeof__ (__real__ (__tgmath_real_type (Val)) 0))\
206 Fct##f (Val) \
207 : (__typeof__ (__real__ (__tgmath_real_type (Val)) 0))\
208 Cfct##f (Val)) \
209 : ((sizeof (__real__ (Val)) == sizeof (Val)) \
210 ? (__typeof__ (__real__ (__tgmath_real_type (Val)) 0))\
211 __tgml(Fct) (Val) \
212 : (__typeof__ (__real__ (__tgmath_real_type (Val)) 0))\
213 __tgml(Cfct) (Val))))
215 /* XXX This definition has to be changed as soon as the compiler understands
216 the imaginary keyword. */
217 # define __TGMATH_BINARY_REAL_IMAG(Val1, Val2, Fct, Cfct) \
218 (__extension__ (((sizeof (__real__ (Val1)) > sizeof (double) \
219 || sizeof (__real__ (Val2)) > sizeof (double)) \
220 && __builtin_classify_type (__real__ (Val1) \
221 + __real__ (Val2)) == 8) \
222 ? ((sizeof (__real__ (Val1)) == sizeof (Val1) \
223 && sizeof (__real__ (Val2)) == sizeof (Val2)) \
224 ? (__typeof ((__tgmath_real_type (Val1)) 0 \
225 + (__tgmath_real_type (Val2)) 0)) \
226 __tgml(Fct) (Val1, Val2) \
227 : (__typeof ((__tgmath_real_type (Val1)) 0 \
228 + (__tgmath_real_type (Val2)) 0)) \
229 __tgml(Cfct) (Val1, Val2)) \
230 : (sizeof (__real__ (Val1)) == sizeof (double) \
231 || sizeof (__real__ (Val2)) == sizeof (double) \
232 || __builtin_classify_type (__real__ (Val1)) != 8 \
233 || __builtin_classify_type (__real__ (Val2)) != 8) \
234 ? ((sizeof (__real__ (Val1)) == sizeof (Val1) \
235 && sizeof (__real__ (Val2)) == sizeof (Val2)) \
236 ? (__typeof ((__tgmath_real_type (Val1)) 0 \
237 + (__tgmath_real_type (Val2)) 0)) \
238 Fct (Val1, Val2) \
239 : (__typeof ((__tgmath_real_type (Val1)) 0 \
240 + (__tgmath_real_type (Val2)) 0)) \
241 Cfct (Val1, Val2)) \
242 : ((sizeof (__real__ (Val1)) == sizeof (Val1) \
243 && sizeof (__real__ (Val2)) == sizeof (Val2)) \
244 ? (__typeof ((__tgmath_real_type (Val1)) 0 \
245 + (__tgmath_real_type (Val2)) 0)) \
246 Fct##f (Val1, Val2) \
247 : (__typeof ((__tgmath_real_type (Val1)) 0 \
248 + (__tgmath_real_type (Val2)) 0)) \
249 Cfct##f (Val1, Val2))))
250 #else
251 # error "Unsupported compiler; you cannot use <tgmath.h>"
252 #endif
255 /* Unary functions defined for real and complex values. */
258 /* Trigonometric functions. */
260 /* Arc cosine of X. */
261 #define acos(Val) __TGMATH_UNARY_REAL_IMAG (Val, acos, cacos)
262 /* Arc sine of X. */
263 #define asin(Val) __TGMATH_UNARY_REAL_IMAG (Val, asin, casin)
264 /* Arc tangent of X. */
265 #define atan(Val) __TGMATH_UNARY_REAL_IMAG (Val, atan, catan)
266 /* Arc tangent of Y/X. */
267 #define atan2(Val1, Val2) __TGMATH_BINARY_REAL_ONLY (Val1, Val2, atan2)
269 /* Cosine of X. */
270 #define cos(Val) __TGMATH_UNARY_REAL_IMAG (Val, cos, ccos)
271 /* Sine of X. */
272 #define sin(Val) __TGMATH_UNARY_REAL_IMAG (Val, sin, csin)
273 /* Tangent of X. */
274 #define tan(Val) __TGMATH_UNARY_REAL_IMAG (Val, tan, ctan)
277 /* Hyperbolic functions. */
279 /* Hyperbolic arc cosine of X. */
280 #define acosh(Val) __TGMATH_UNARY_REAL_IMAG (Val, acosh, cacosh)
281 /* Hyperbolic arc sine of X. */
282 #define asinh(Val) __TGMATH_UNARY_REAL_IMAG (Val, asinh, casinh)
283 /* Hyperbolic arc tangent of X. */
284 #define atanh(Val) __TGMATH_UNARY_REAL_IMAG (Val, atanh, catanh)
286 /* Hyperbolic cosine of X. */
287 #define cosh(Val) __TGMATH_UNARY_REAL_IMAG (Val, cosh, ccosh)
288 /* Hyperbolic sine of X. */
289 #define sinh(Val) __TGMATH_UNARY_REAL_IMAG (Val, sinh, csinh)
290 /* Hyperbolic tangent of X. */
291 #define tanh(Val) __TGMATH_UNARY_REAL_IMAG (Val, tanh, ctanh)
294 /* Exponential and logarithmic functions. */
296 /* Exponential function of X. */
297 #define exp(Val) __TGMATH_UNARY_REAL_IMAG (Val, exp, cexp)
299 /* Break VALUE into a normalized fraction and an integral power of 2. */
300 #define frexp(Val1, Val2) __TGMATH_BINARY_FIRST_REAL_ONLY (Val1, Val2, frexp)
302 /* X times (two to the EXP power). */
303 #define ldexp(Val1, Val2) __TGMATH_BINARY_FIRST_REAL_ONLY (Val1, Val2, ldexp)
305 /* Natural logarithm of X. */
306 #define log(Val) __TGMATH_UNARY_REAL_IMAG (Val, log, clog)
308 /* Base-ten logarithm of X. */
309 #ifdef __USE_GNU
310 # define log10(Val) __TGMATH_UNARY_REAL_IMAG (Val, log10, __clog10)
311 #else
312 # define log10(Val) __TGMATH_UNARY_REAL_ONLY (Val, log10)
313 #endif
315 /* Return exp(X) - 1. */
316 #define expm1(Val) __TGMATH_UNARY_REAL_ONLY (Val, expm1)
318 /* Return log(1 + X). */
319 #define log1p(Val) __TGMATH_UNARY_REAL_ONLY (Val, log1p)
321 /* Return the base 2 signed integral exponent of X. */
322 #define logb(Val) __TGMATH_UNARY_REAL_ONLY (Val, logb)
324 /* Compute base-2 exponential of X. */
325 #define exp2(Val) __TGMATH_UNARY_REAL_ONLY (Val, exp2)
327 /* Compute base-2 logarithm of X. */
328 #define log2(Val) __TGMATH_UNARY_REAL_ONLY (Val, log2)
331 /* Power functions. */
333 /* Return X to the Y power. */
334 #define pow(Val1, Val2) __TGMATH_BINARY_REAL_IMAG (Val1, Val2, pow, cpow)
336 /* Return the square root of X. */
337 #define sqrt(Val) __TGMATH_UNARY_REAL_IMAG (Val, sqrt, csqrt)
339 /* Return `sqrt(X*X + Y*Y)'. */
340 #define hypot(Val1, Val2) __TGMATH_BINARY_REAL_ONLY (Val1, Val2, hypot)
342 /* Return the cube root of X. */
343 #define cbrt(Val) __TGMATH_UNARY_REAL_ONLY (Val, cbrt)
346 /* Nearest integer, absolute value, and remainder functions. */
348 /* Smallest integral value not less than X. */
349 #define ceil(Val) __TGMATH_UNARY_REAL_ONLY (Val, ceil)
351 /* Absolute value of X. */
352 #define fabs(Val) __TGMATH_UNARY_REAL_IMAG_RET_REAL (Val, fabs, cabs)
354 /* Largest integer not greater than X. */
355 #define floor(Val) __TGMATH_UNARY_REAL_ONLY (Val, floor)
357 /* Floating-point modulo remainder of X/Y. */
358 #define fmod(Val1, Val2) __TGMATH_BINARY_REAL_ONLY (Val1, Val2, fmod)
360 /* Round X to integral valuein floating-point format using current
361 rounding direction, but do not raise inexact exception. */
362 #define nearbyint(Val) __TGMATH_UNARY_REAL_ONLY (Val, nearbyint)
364 /* Round X to nearest integral value, rounding halfway cases away from
365 zero. */
366 #define round(Val) __TGMATH_UNARY_REAL_ONLY (Val, round)
368 /* Round X to the integral value in floating-point format nearest but
369 not larger in magnitude. */
370 #define trunc(Val) __TGMATH_UNARY_REAL_ONLY (Val, trunc)
372 /* Compute remainder of X and Y and put in *QUO a value with sign of x/y
373 and magnitude congruent `mod 2^n' to the magnitude of the integral
374 quotient x/y, with n >= 3. */
375 #define remquo(Val1, Val2, Val3) \
376 __TGMATH_TERNARY_FIRST_SECOND_REAL_ONLY (Val1, Val2, Val3, remquo)
378 /* Round X to nearest integral value according to current rounding
379 direction. */
380 #define lrint(Val) __TGMATH_UNARY_REAL_RET_ONLY (Val, long int, lrint)
381 #define llrint(Val) __TGMATH_UNARY_REAL_RET_ONLY (Val, long long int, llrint)
383 /* Round X to nearest integral value, rounding halfway cases away from
384 zero. */
385 #define lround(Val) __TGMATH_UNARY_REAL_RET_ONLY (Val, long int, lround)
386 #define llround(Val) __TGMATH_UNARY_REAL_RET_ONLY (Val, long long int, llround)
389 /* Return X with its signed changed to Y's. */
390 #define copysign(Val1, Val2) __TGMATH_BINARY_REAL_ONLY (Val1, Val2, copysign)
392 /* Error and gamma functions. */
393 #define erf(Val) __TGMATH_UNARY_REAL_ONLY (Val, erf)
394 #define erfc(Val) __TGMATH_UNARY_REAL_ONLY (Val, erfc)
395 #define tgamma(Val) __TGMATH_UNARY_REAL_ONLY (Val, tgamma)
396 #define lgamma(Val) __TGMATH_UNARY_REAL_ONLY (Val, lgamma)
399 /* Return the integer nearest X in the direction of the
400 prevailing rounding mode. */
401 #define rint(Val) __TGMATH_UNARY_REAL_ONLY (Val, rint)
403 #if __GLIBC_USE (IEC_60559_BFP_EXT)
404 /* Return X - epsilon. */
405 # define nextdown(Val) __TGMATH_UNARY_REAL_ONLY (Val, nextdown)
406 /* Return X + epsilon. */
407 # define nextup(Val) __TGMATH_UNARY_REAL_ONLY (Val, nextup)
408 #endif
410 /* Return X + epsilon if X < Y, X - epsilon if X > Y. */
411 #define nextafter(Val1, Val2) __TGMATH_BINARY_REAL_ONLY (Val1, Val2, nextafter)
412 #define nexttoward(Val1, Val2) \
413 __TGMATH_BINARY_FIRST_REAL_ONLY (Val1, Val2, nexttoward)
415 /* Return the remainder of integer divison X / Y with infinite precision. */
416 #define remainder(Val1, Val2) __TGMATH_BINARY_REAL_ONLY (Val1, Val2, remainder)
418 /* Return X times (2 to the Nth power). */
419 #ifdef __USE_MISC
420 # define scalb(Val1, Val2) __TGMATH_BINARY_REAL_ONLY (Val1, Val2, scalb)
421 #endif
423 /* Return X times (2 to the Nth power). */
424 #define scalbn(Val1, Val2) __TGMATH_BINARY_FIRST_REAL_ONLY (Val1, Val2, scalbn)
426 /* Return X times (2 to the Nth power). */
427 #define scalbln(Val1, Val2) \
428 __TGMATH_BINARY_FIRST_REAL_ONLY (Val1, Val2, scalbln)
430 /* Return the binary exponent of X, which must be nonzero. */
431 #define ilogb(Val) __TGMATH_UNARY_REAL_RET_ONLY (Val, int, ilogb)
434 /* Return positive difference between X and Y. */
435 #define fdim(Val1, Val2) __TGMATH_BINARY_REAL_ONLY (Val1, Val2, fdim)
437 /* Return maximum numeric value from X and Y. */
438 #define fmax(Val1, Val2) __TGMATH_BINARY_REAL_ONLY (Val1, Val2, fmax)
440 /* Return minimum numeric value from X and Y. */
441 #define fmin(Val1, Val2) __TGMATH_BINARY_REAL_ONLY (Val1, Val2, fmin)
444 /* Multiply-add function computed as a ternary operation. */
445 #define fma(Val1, Val2, Val3) \
446 __TGMATH_TERNARY_REAL_ONLY (Val1, Val2, Val3, fma)
448 #if __GLIBC_USE (IEC_60559_BFP_EXT)
449 /* Round X to nearest integer value, rounding halfway cases to even. */
450 # define roundeven(Val) __TGMATH_UNARY_REAL_ONLY (Val, roundeven)
452 # define fromfp(Val1, Val2, Val3) \
453 __TGMATH_TERNARY_FIRST_REAL_RET_ONLY (Val1, Val2, Val3, __intmax_t, fromfp)
455 # define ufromfp(Val1, Val2, Val3) \
456 __TGMATH_TERNARY_FIRST_REAL_RET_ONLY (Val1, Val2, Val3, __uintmax_t, ufromfp)
458 # define fromfpx(Val1, Val2, Val3) \
459 __TGMATH_TERNARY_FIRST_REAL_RET_ONLY (Val1, Val2, Val3, __intmax_t, fromfpx)
461 # define ufromfpx(Val1, Val2, Val3) \
462 __TGMATH_TERNARY_FIRST_REAL_RET_ONLY (Val1, Val2, Val3, __uintmax_t, ufromfpx)
464 /* Like ilogb, but returning long int. */
465 # define llogb(Val) __TGMATH_UNARY_REAL_RET_ONLY (Val, long int, llogb)
467 /* Return value with maximum magnitude. */
468 # define fmaxmag(Val1, Val2) __TGMATH_BINARY_REAL_ONLY (Val1, Val2, fmaxmag)
470 /* Return value with minimum magnitude. */
471 # define fminmag(Val1, Val2) __TGMATH_BINARY_REAL_ONLY (Val1, Val2, fminmag)
473 /* Total order operation. */
474 # define totalorder(Val1, Val2) __TGMATH_BINARY_REAL_ONLY (Val1, Val2, \
475 totalorder)
477 /* Total order operation on absolute values. */
478 # define totalordermag(Val1, Val2) __TGMATH_BINARY_REAL_ONLY (Val1, Val2, \
479 totalordermag)
480 #endif
483 /* Absolute value, conjugates, and projection. */
485 /* Argument value of Z. */
486 #define carg(Val) __TGMATH_UNARY_REAL_IMAG_RET_REAL (Val, carg, carg)
488 /* Complex conjugate of Z. */
489 #define conj(Val) __TGMATH_UNARY_IMAG (Val, conj)
491 /* Projection of Z onto the Riemann sphere. */
492 #define cproj(Val) __TGMATH_UNARY_IMAG (Val, cproj)
495 /* Decomposing complex values. */
497 /* Imaginary part of Z. */
498 #define cimag(Val) __TGMATH_UNARY_REAL_IMAG_RET_REAL (Val, cimag, cimag)
500 /* Real part of Z. */
501 #define creal(Val) __TGMATH_UNARY_REAL_IMAG_RET_REAL (Val, creal, creal)
503 #endif /* tgmath.h */